#include <bits/stdc++.h>
using namespace std;
string s1, s2;
bool cmp(pair<int, int> x, pair<int, int> y) {
  if (x.first < y.first)
    return true;
  else if (x.first == y.first) {
    return x.second > y.second;
  } else
    return false;
}
void solve() {
  int n, k;
  cin >> n >> k;
  cin >> s1;
  sort(s1.begin(), s1.end());
  if (s1[0] != s1[k - 1])
    cout << s1[k - 1] << endl;
  else {
    if (k < n && s1[n - 1] == s1[k]) {
      for (int i = 0; i < n; i++) {
        if (i % k == 0) cout << s1[i];
      }
      cout << endl;
    } else {
      for (int i = k - 1; i < n; i++) cout << s1[i];
      cout << endl;
    }
  }
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
