#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int test = 1;
  cin >> test;
  while (test--) {
    long long int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    long long int app = 0;
    for (int i = 0; i < s.size(); i++)
      if (s[i] == s[0])
        app++;
      else
        break;
    if (app < k) {
      cout << s[k - 1] << endl;
    } else {
      bool flag = true;
      for (int i = k; i < s.size(); i++)
        if (s[i] != s[k]) {
          flag = false;
          break;
        }
      if (flag) {
        long long int val =
            (long long int)ceil(((long long int)s.size() - k) / (k * 1.0));
        cout << s[0];
        for (long long int i = 0; i < val; i++) cout << s[k];
        cout << endl;
      } else {
        cout << s[0];
        for (long long int i = k; i < s.size(); i++) cout << s[i];
        cout << endl;
      }
    }
  }
  return;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
