#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   #pragma GCC optimization( unroll-loops )   std::pair<int, int> DR[] = {{-1, 0}, {0, 1},   {1, 0}, {0, -1},                               {-1, 1}, {-1, -1}, {1, 1}, {1, -1}};   using namespace std;   const long long mod = 998244353;   long long nop = 70;   vector<int> primes(nop + 1, 1);   void sieve() {     primes[1] = primes[0] = 0;     for (long long i = 2; i * i <= nop; i++) {       if (primes[i]) {         for (long long j = i * i; j <= nop; j += i) {           primes[j] = 0;         }       }     }   }   long long gcd(long long a, long long b) {     if (b > a) swap(b, a);     if (b == 0) return a;     return gcd(b, a % b);   }   void extgcd(long long a, long long b, long long& x, long long& y) {     if (a == 0) {       x = a;       y = b;       return;     }     extgcd(b % a, a, x, y);     long long y1 = y, x1 = x;     x = y1 - (b / a) * x1;     y = x1;   }   long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }   long long bexp(long long num, long long e) {     long long ans = 1;     while (e > 0) {       if (e & 1) {         ans *= num;       }       num *= num;       e >>= 1;     }     return ans;   }   long long mexp(long long num, long long e) {     long long ans = 1;     while (e > 0) {       if (e & 1) {         ans = (ans * num) % mod;       }       num *= num;       num %= mod;       e >>= 1;     }     return ans % mod;   }   long long modinv(long long a) {     a %= mod;     return mexp(a, mod - 2);   }   void solve() {     long long n, k;     cin >> n >> k;     string s;     cin >> s;     sort(s.begin(), s.end());     vector<long long> cnt(26, 0);     for (long long i = 0; i < (n); i++) {       cnt[s[i] -  a ]++;     }     int first = -1, last = -1, nod = 0;     for (long long i = 0; i < (26); i++) {       if (cnt[i]) {         nod++;         if (first == -1) first = i;         last = i;       }     }     if (cnt[first] < k) {       cout << s[k - 1] <<   n ;       return;     }     string worst =   ;     worst += char( a  + first);     if (nod >= 3 || (nod == 2 && cnt[first] > k)) {       for (long long i = k; i < n; i++) {         worst += s[i];       }     } else {       for (long long i = k; i < n; i++) {         worst += s[i];         i += (k - 1);       }     }     cout << worst <<   n ;   }   int main() {     cin.tie(0);     cout.tie(0);     ios::sync_with_stdio(0);     int t = 1;     cin >> t;     for (long long T = 1; T <= (t); T++) {       solve();     }     return 0;   }   