#include <bits/stdc++.h>
using namespace std;
const int sz = 26;
bool OK = false;

bool is_palindrome(string&s){
    int n = int(s.size());
    for(int i = 0; i < n; i++){
        if(s[i] != s[n - i - 1]) return false;
    }
    return true;
}

bool check(vector<int>&part, string&s, int m){
    sort(s.begin(), s.end());

    do{
        bool good = true;
        int shift = 0;
        for(int i = 0; i < m; i++){
            string str = s.substr(shift, part[i]);
            if(!is_palindrome(str)){
                good = false;
                break;
            }
            shift += part[i];
        }
        if(good) return true;

    }while(next_permutation(s.begin(), s.end()));
    return false;
}

void gen(vector<int>&part, int n, int m, int cur_sum, string&s){
    int cur_sz = int(part.size());
    if(cur_sz == m){
        if(cur_sum == n){
            if(check(part, s, m)) OK = true;
        }
        return;
    }
    int pos_left = m - cur_sz - 1;
    for(int i = 1; i <= n - cur_sum - pos_left; i++){
        part.emplace_back(i);
        gen(part, n, m, cur_sum + i, s);
        part.pop_back();
    }
}

string solve(){
    OK = false;
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    vector<int>base;
    gen(base, n, m, 0, s);
    if(OK) return "YES";
    else return "NO";
}

int main(){
    int t;
    cin >> t;
    while(t--){
        cout << solve() << "\n";
    }
    return 0;
}