---
{"category_name":"easy","problem_code":"KOL1504","problem_name":"The making of a cake","languages_supported":{"0":"C","1":"CPP14","2":"JAVA"},"max_timelimit":1,"source_sizelimit":50000,"problem_author":"devuy11","problem_tester":null,"date_added":"9-12-2015","tags":{"0":"acm15kol","1":"devuy11","2":"sorting"},"editorial_url":"http://discuss.codechef.com/problems/KOL1504","time":{"view_start_date":1451123700,"submit_start_date":1451123700,"visible_start_date":1451123700,"end_date":1735669800},"layout":"problem"}
---
<span class="solution-visible-txt">All submissions for this problem are available.</span><p>
CodeChef has received an order from the President of Mithai country for his son's birthday cake. The president is a person of very high temper and CodeChef doesn't want to tick him him, so he had to prepare a cake exactly as described by the President's son. He asked for a cake with <b>N</b> layers and each layer has to be of a type specified by him. The type of layer is represented by a lowercase letter from the English alphabet.
</p>
<p>
CodeChef asked his sous Chef, Jalebi Bai, to make this cake, who was very sleepy due to a very long and tiring journey to a planet far far away earlier.
Due to tiredness, Jalebi Bai screwed up the the layers while baking the cake. Thankfully, it has the same number of layers as required, but any of the layers may or may not be the same as described in the order. CodeChef is really worried because of this, as making a new cake will cost him a huge amount of money.
<p>
At this point of time, Samosa Bhai comes to the rescue. He has a layer swapper (patent pending) which can swap the layers of a cake without ruining the cake. This swapper has a limitation that it can swap layers separated <b>exactly</b> by distance <b>D</b> only, meaning there should be <b>exactly</b> <b>D-1</b> layers in between the two layers to be swapped.
</p>
<p>
You have to tell if the cake made by Jalebi Bai can be changed into the cake described by the President's son using Samosa Bhai's swapper.
</p>
<h3>Input</h3>
<p>The first line contains <b>T</b>, the number of test cases.</p>
<p>The first line of each test case contains <b>N</b> and <b>D</b>.</p>
<p>The next line contains a lowercase string <b>A</b> representing the cake described by the President's son.</p>
<p>The next line contains a lowercase string <b>B</b> representing the cake made by Jalebi Bai.</p>
<h3>Output</h3>
<p>For each test case, output "<b>Yes</b>" [without quotes] if it is possible to transform the cake <b>B</b> into cake <b>A</b> using the layer swapper. Otherwise, output "<b>No</b>" [without quotes].</p>
<h3>Constraints</h3>
<ul>
<li><b>1</b> ≤ <b>T</b> ≤ <b>20000</b></li>
<li><b>1</b> ≤ <b>N</b> ≤ <b>10<sup>5</sup></b></li>
<li><b>1</b> ≤ <b>D</b> ≤ <b>10<sup>5</sup></b></li>
<li><b>Size of String A = Size of String B = N</b></li>
<li><b>1</b> ≤ <b>Sum of N</b> ≤ <b>10<sup>5</sup></b></li>
<li><b>All characters are from 'a' to 'z' in string A and B.</b></li>
</ul>
<h3>Example</h3>
<pre><b>Input:</b>
5
4 2
qnyu
ynqu
4 1
fbnc
nbcf
5 2
abcde
edacb
5 2
abcde
edabc
3 1
eff
bae
<b>Output:</b>
Yes
Yes
No
Yes
No
</pre>
<h3>Explanation</h3>
<p><b>Example case 1.</b> Swap layer 'y' with 'q'.</p>
<p><b>Example case 2.</b> Follow the following swap order:
<ul>
<li>Swap Layer 'f' with 'c', The cake will now be "nbfc"</li>
<li>Swap Layer 'n' with 'b', The cake will now be "bnfc"</li>
<li>Swap Layer 'n' with 'f', The cake will now be "bfnc"</li>
<li>Swap Layer 'f' with 'b', The cake will now be "fbnc"</li>
</ul></p>
<p><b>Example case 4.</b> Follow the following swap order:
<ul>
<li>Swap Layer 'b' with 'd', The cake will now be "ebadc"</li>
<li>Swap Layer 'a' with 'e', The cake will now be "abedc"</li>
<li>Swap Layer 'e' with 'c', The cake will now be "abcde"</li>
</ul></p>