#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f, mod = 1000000007;
const double pi = 3.1415926535897932, eps = 1e-6;
void chmax(int &x, int y) {
  if (x < y) x = y;
}
void chmin(int &x, int y) {
  if (x > y) x = y;
}
int T, n, k, cnt[30];
string s, ans;
void solve() {
  ans = "";
  cin >> n >> k >> s;
  for (int(i) = (0); (i) <= (26); (i)++) cnt[i] = 0;
  for (int(i) = (0); (i) < (n); (i)++) cnt[s[i] - 97]++;
  int lst = 0, out = 0, id = 0, fir = 27;
  for (int(i) = (0); (i) <= (25); (i)++)
    if (cnt[i]) lst = i, fir = min(fir, i);
  for (int(i) = (0); (i) <= (25); (i)++) {
    int nv = min(out + cnt[i], k);
    cnt[i] -= nv - out;
    out = nv;
    if (out >= k) {
      id = i;
      break;
    }
  }
  ans += char(id + 'a');
  if (id == fir)
    for (int(i) = (id); (i) <= (25); (i)++) {
      if (i == lst && ans.size() == 1) {
        for (int(j) = (1); (j) <= ((cnt[i] + k - 1) / k); (j)++)
          ans += char(i + 'a');
      } else
        for (int(j) = (1); (j) <= (cnt[i]); (j)++) ans += char(i + 'a');
    }
  cout << ans << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin >> T;
  while (T--) solve();
  return 0;
}
