#include <bits/stdc++.h>
using namespace std;
bool compare(string a, string b) { return a < b; }
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    string to_work(s);
    sort(to_work.begin(), to_work.end());
    if (to_work[0] != to_work[k - 1]) {
      cout << to_work[k - 1] << endl;
      continue;
    }
    cout << to_work[0];
    if (to_work[k] != to_work[n - 1]) {
      for (int i = k; i < n; i++) {
        cout << to_work[i];
      }
    } else {
      for (int i = 0; i < ceil((float)(n - k) / (float)k); i++) {
        cout << to_work[n - 1];
      }
    }
    cout << endl;
  }
}
