#include <bits/stdc++.h>
using namespace std;
char s[100005];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    cin >> s + 1;
    int d[30] = {0};
    char tt = 'z';
    for (int i = 1; i <= n; i++) d[s[i] - 'a']++, tt = min(tt, s[i]);
    string ans = "", tmp = "";
    int now = 1, i = 0, ct = 0, f = 0, sum = 0, ss = n;
    while (i < 26) {
      sum += d[i];
      if (d[i]) ct++;
      if (sum >= k) break;
      i++;
    }
    if (ct >= 2) {
      cout << char(i + 'a') << endl;
      continue;
    }
    ans += char(i + 'a');
    ct = 0, ss = 0;
    if (sum > k) {
      tt = char(i + 'a');
      ct++;
      ss = sum - k;
      for (int j = k + 1; j <= sum; j++) tmp += char(i + 'a');
    }
    i++;
    while (i < 26) {
      if (d[i]) {
        ct++;
        ss += d[i];
        tt = char(i + 'a');
        for (int j = 1; j <= d[i]; j++) tmp += char(i + 'a');
      }
      i++;
    }
    if (ct == 1) {
      cout << ans;
      for (int j = 1; j <= (ss + k - 1) / k; j++) cout << tt;
      cout << endl;
    } else
      cout << ans + tmp << endl;
  }
  return 0;
}
