#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if (k == 1) {
      cout << s << endl;
      continue;
    }
    if (k == n) {
      cout << s[n - 1] << endl;
      continue;
    }
    bool flag = false;
    for (long long int i = 0; i < k; i++) {
      if (s[i] != s[k - 1]) flag = true;
    }
    if (flag) {
      cout << s[k - 1] << endl;
      continue;
    }
    if (s[n - 1] != s[k]) {
      string res = "";
      for (long long int i = k - 1; i < n; i++) {
        res += s[i];
      }
      cout << res << endl;
    } else {
      long long int rem = n - k;
      long long int p1 = rem / k;
      if (rem % k) p1++;
      rem = p1;
      string res = "";
      res += s[k - 1];
      for (long long int i = 0; i < rem; i++) {
        res += s[k];
      }
      cout << res << endl;
    }
  }
}
