#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int64_t tc;
  cin >> tc;
  while (tc--) {
    uint64_t len, k;
    cin >> len >> k;
    string txt;
    cin >> txt;
    sort(txt.begin(), txt.end());
    if (txt[0] != txt[k - 1]) {
      cout << txt[k - 1] << endl;
      continue;
    }
    string res;
    res.push_back(txt[0]);
    if (txt[k] != txt[len - 1]) {
      for (int i = k; i < len; i++) {
        res.push_back(txt[i]);
      }
    } else {
      for (int i = k; i < len; i += k) {
        res.push_back(txt[i]);
      }
    }
    cout << res << endl;
  }
  return 0;
}
