#include <bits/stdc++.h>
using namespace std;
long long cl(long long n, long long m) {
  if (n % m)
    return n / m + 1;
  else
    return n / m;
}
long long pw(long long a, long long b, long long M) {
  a %= M;
  long long r = 1;
  while (b > 0) {
    if (b & 1) r = r * a % M;
    a = a * a % M;
    b >>= 1;
  }
  return r;
}
const long long N = 1e6 + 5;
signed main() {
  long long TT;
  cin >> TT;
  while (TT--) {
    long long n, k;
    map<long long, long long> m;
    cin >> n >> k;
    string s;
    cin >> s;
    long long mx = 0;
    for (long long i = 0; i < s.size(); i++)
      m[s[i] - 'a']++, mx = max(mx, m[s[i] - 'a']);
    string st[k];
    for (long long i = 0; i <= k - 1; i++) st[i] = "";
    long long t = 0;
    long long cnt = 0;
    for (long long i = 0; i < k; i++) {
      if (m[t] > 0)
        st[i] += (char)(t + 'a'), m[t]--;
      else {
        while (m[t] == 0) {
          t++;
          if (t == 26) {
            goto bahr;
          }
        }
        i--;
        continue;
      }
    }
  bahr : {}
    for (long long i = 0; i < 26; i++) {
      if (m[i] > 0) cnt++;
    }
    if (st[0] != st[k - 1]) {
      cout << st[k - 1] << endl;
      continue;
    }
    if (cnt > 1) {
      cout << st[0];
      for (long long i = 0; i < 26; i++) {
        while (m[i] > 0) {
          cout << (char)(i + 'a');
          m[i]--;
        }
      }
      cout << endl;
    } else if (cnt == 1) {
      long long mx = 0;
      for (long long i = 0; i < 26; i++) {
        if (m[i] > 0) mx = i, cnt = m[i];
      }
      cout << st[0];
      for (long long i = 0; i < cl(cnt, k); i++) {
        cout << (char)(mx + 'a');
      }
      cout << endl;
    } else {
      cout << st[0] << endl;
    }
  }
}
