#P1800E2. Unforgivable Curse (hard version)

    ID: 8253 Type: RemoteJudge 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>brute forceconstructive algorithmsdsugraphsgreedy

Unforgivable Curse (hard version)

No submission language available for this problem.

Description

This is a complex version of the problem. This version has no additional restrictions on the number kk.

The chief wizard of the Wizengamot once caught the evil wizard Drahyrt, but the evil wizard has returned and wants revenge on the chief wizard. So he stole spell ss from his student Harry.

The spell — is a nn-length string of lowercase Latin letters.

Drahyrt wants to replace spell with an unforgivable curse — string tt.

Dragirt, using ancient magic, can swap letters at a distance kk or k+1k+1 in spell as many times as he wants. In other words, Drahyrt can change letters in positions ii and jj in spell ss if ij=k|i-j|=k or ij=k+1|i-j|=k+1.

For example, if k=3,s=k = 3, s = "talant" and t=t = "atltna", Drahyrt can act as follows:

  • swap the letters at positions 11 and 44 to get spell "aaltnt".
  • swap the letters at positions 22 and 66 to get spell "atltna".

You are given spells ss and tt. Can Drahyrt change spell ss to tt?

The first line of input gives a single integer TT (1T1041 \le T \le 10^4) — the number of test cases in the test.

Descriptions of the test cases are follow.

The first line contains two integers n,kn, k (1n21051 \le n \le 2 \cdot 10^5, 1k21051 \le k \le 2 \cdot 10^5) — the length spells and the number kk such that Drahyrt can change letters in a spell at a distance kk or k+1k+1.

The second line gives spell ss — a string of length nn consisting of lowercase Latin letters.

The third line gives spell tt — a string of length nn consisting of lowercase Latin letters.

It is guaranteed that the sum of nn values over all test cases does not exceed 21052 \cdot 10^5. Note that there is no limit on the sum of kk values over all test cases.

For each test case, output on a separate line "YES" if Drahyrt can change spell ss to tt and "NO" otherwise.

You can output the answer in any case (for example, lines "yEs", "yes", "Yes" and "YES" will be recognized as positive answer).

Input

The first line of input gives a single integer TT (1T1041 \le T \le 10^4) — the number of test cases in the test.

Descriptions of the test cases are follow.

The first line contains two integers n,kn, k (1n21051 \le n \le 2 \cdot 10^5, 1k21051 \le k \le 2 \cdot 10^5) — the length spells and the number kk such that Drahyrt can change letters in a spell at a distance kk or k+1k+1.

The second line gives spell ss — a string of length nn consisting of lowercase Latin letters.

The third line gives spell tt — a string of length nn consisting of lowercase Latin letters.

It is guaranteed that the sum of nn values over all test cases does not exceed 21052 \cdot 10^5. Note that there is no limit on the sum of kk values over all test cases.

Output

For each test case, output on a separate line "YES" if Drahyrt can change spell ss to tt and "NO" otherwise.

You can output the answer in any case (for example, lines "yEs", "yes", "Yes" and "YES" will be recognized as positive answer).

Sample Input 1

7
6 3
talant
atltna
7 1
abacaba
aaaabbc
12 6
abracadabraa
avadakedavra
5 3
accio
cicao
5 4
lumos
molus
4 3
uwjt
twju
4 3
kvpx
vxpk

Sample Output 1

YES
YES
NO
YES
NO
YES
NO

Note

The first case is explained in the condition.

In the second case, we can swap adjacent letters, so we can sort the string using bubble sorting, for example.

In the third case, we can show that from the string ss we cannot get the string tt by swapping letters at a distance of 66 or 77.

In the fourth case, for example, the following sequence of transformations is appropriate:

  • "accio" \rightarrow "aocic" \rightarrow "cocia" \rightarrow "iocca" \rightarrow "aocci" \rightarrow "aicco" \rightarrow "cicao"

In the fifth case, we can show that it is impossible to get the string ss from the string tt.

In the sixth example, it is enough to swap the two outermost letters.