// start fold
#include <bits/stdc++.h>
#ifdef LOCAL
#include <sys/resource.h>
#include <sys/time.h>
#define MAX_FILE_SIZE 536870912
#define CPU_TIME 2
#endif
#define endl '\n'
using namespace std;
using ull = unsigned long long;
using ll = long long;
using ld = long double;

#define in cin
#define out cout

typedef int                     integer;
#define int                     long long
typedef pair<int, int>          pii;
#define vii                     vector<pair<int,int>>
#define vi                      vector<int>
#define vvi                     vector<vector<int>>
#define rep(i, a, b)            for(int i = a; i < (b); i++)
#define s(x)                    in>>x
#define s2(x,y)                 in>>x>>y
#define s3(x,y,z)               in>>x>>y>>z
#define s4(x,y,z,w)             in>>x>>y>>z>>w
#define p(x)                    out<<(x)<<endl
#define p2(x,y)                 out<<(x)<<' '<<(y)<<endl
#define p3(x,y,z)               out<<(x)<<' '<<(y)<<' '<<(z)<<endl
#define p4(x,y,z,w)             out<<(x)<<' '<<(y)<<' '<<(z)<<' '<<(w)<<endl
#define p1d(a,n)                for(int ix=0;ix<n-1;ix++) out<<a[ix]<<' '; out<<a[n-1]<<'\n';
#define p2d(a,n,m)              for(int ix=0;ix<n;ix++){ for(int jx=0;jx<m;jx++) out<<a[ix][jx]<<" "; out<<endl;}
#define pl(x)                   out<<(x)
#define pll(x)                  out<<(x)<<' '
#define range(v)                v.begin(),v.end()
#define all(x)                  begin(x), end(x)
#define sz(x)                   (int)(x).size()
#define rst(x)                  memset(x, -1, sizeof(x))

#define EACH(x, a) for (auto& x: a)
template<class T> void read_v(T& x, std::istream& in) {
    in >> (x);
}
template<class A> void read_vec(vector<A>& x, std::istream& in) {
    EACH(a, x)
        read_v(a, in);
}

void __print(integer x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (const auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ["; _print(__VA_ARGS__)
#else
#define debug(...) 42
#endif

int iceildiv(const int a, const int b){ if(a==0){return 0;} return (1 + ((a - 1)/b));}
bool sortpairbysec(const pair<int,int> &a,const pair<int,int> &b){return (a.second < b.second);}
template <typename T> T factmod(T a, T modulus){ int res = 1, i; for (i = 2; i <= a; i++){ res *= i; res%=modulus;} return res; }
template <typename T> int powmod(T a, T b, const int m){ int ans=1; while(b>0){if(b&1){ans*=a;ans%=m;}a*=a;a%=m;b>>=1;} return ans; }
template <typename T> int power(T a, T b){ int ans=1; while(b>0){if(b&1){ans*=a;}a*=a;b>>=1;}return ans;}
template <typename T> void setmin(T& a, T b) { if (b < a) a = b; }
template <typename T> void setmax(T& a, T b) { if (b > a) a = b; }
// end fold

void solve(){
    int n, k; s2(n, k);
    string st1, st2; s2(st1, st2);
    debug(st1);
    debug(st2);
    vi cnt1(26, 0), cnt2(26, 0);
    for(char c: st1) cnt1[c-'a']++;
    for(char c: st2) cnt2[c-'a']++;
    for(int i = 0; i < 25; i++){
        int diff = cnt2[i] - cnt1[i];
        if(diff == 0) continue;
        if(diff > 0){ p("No"); return; }

        if(diff < 0){
            if(abs(diff) >= k){
                cnt1[i + 1] += k * (abs(diff)/k);
            }
        }
    }
    if(cnt1[25] == cnt2[25]){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

// start fold
integer main() {
#ifdef LOCAL
        rlimit rlim, rlim_time;
        if(getrlimit(RLIMIT_FSIZE, &rlim) || getrlimit(RLIMIT_CPU , &rlim_time))  
            return 1 ; 
        rlim.rlim_cur = MAX_FILE_SIZE; // maximum file size (in bytes) that your program will be able to create
        rlim_time.rlim_cur = CPU_TIME; // maximum allowed runtime for your program
        if(setrlimit(RLIMIT_FSIZE, &rlim) || setrlimit(RLIMIT_CPU , &rlim_time))
            return 2;
#endif
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int test_cases = 1;
    cin >> test_cases;
    while(test_cases--){
        solve();
    }
    return 0;
}
// end fold
