#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    map<char, int> store;
    for (int i = 0; i < n; i++) {
      store[s[i]]++;
    }
    if (store.size() == 1) {
      int temp = n / k;
      if (n % k != 0) temp++;
      for (int i = 0; i < temp; i++) cout << s[0];
    } else if (store.size() == 2 && store[s[0]] == k) {
      cout << s[0];
      int temp = n / k;
      if (n % k != 0) temp++;
      for (int i = 0; i < temp - 1; i++) cout << s[k];
    } else {
      if (s[0] != s[k - 1])
        cout << s[k - 1];
      else {
        for (int i = k - 1; i < n; i++) cout << s[i];
      }
    }
    cout << "\n";
  }
  return 0;
}
