#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T;
  cin >> T;
  while (T--) {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if (s[k - 1] != s[0]) {
      cout << s[k - 1] << endl;
    } else {
      if (s[n - 1] != s[k]) {
        string tmp = "";
        tmp += s[0];
        for (int i = k; i < n; i++) {
          tmp += s[i];
        }
        cout << tmp << endl;
      } else {
        int tmp = (n - k - 1) / k + 1;
        string tmp2 = "";
        tmp2 += s[0];
        for (int i = 0; i < tmp; i++) {
          tmp2 += s[k];
        }
        cout << tmp2 << endl;
      }
    }
  }
}
