#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int len, k;
    cin >> len >> k;
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if (s[0] != s[k - 1])
      cout << s[k - 1] << endl;
    else {
      cout << s[k - 1];
      if (s[k] == s[len - 1]) {
        int q = (len - k) / k;
        if ((len - k) % k) q++;
        while (q--) cout << s[k];
      } else
        for (int i = k; i < len; i++) cout << s[i];
      cout << endl;
    }
  }
  return 0;
}
