for _ in range(int(input())): n, k = map(int, input().split()) s = input() t = input() if n <= k: print("YES" if s == t else "NO") continue p = n - k print("YES" if sorted(s) == sorted(t) and s[p:-p] == t[p:-p] else "NO")
?