#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if (s[0] != s[k - 1]) {
      cout << s[k - 1];
      cout << "\n";
      continue;
    }
    if (s[n - 1] == s[k]) {
      cout << s[0];
      int i = k;
      while (i < n) {
        cout << s[i];
        i += k;
      }
      cout << "\n";
      continue;
    }
    cout << s[0];
    s = s.substr(k, n - k);
    cout << s << endl;
  }
}
