#include <bits/stdc++.h>
using namespace std;
long long mod = 998244353, maxLevel = 0;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    int n, k, flag = 0;
    string s;
    cin >> n >> k;
    cin >> s;
    set<char> set1;
    sort(s.begin(), s.end());
    char first, last;
    for (int i = k; i < n; i++) {
      set1.insert(s[i]);
      if (flag == 0) {
        first = s[i];
        flag = 1;
      }
    }
    if (s[0] != s[k - 1]) {
      cout << s[k - 1] << "\n";
    } else {
      if (set1.size() == 1) {
        cout << s[0];
        for (int i = 0; i < (n - k) / k; i++) cout << s[k];
        if ((n - k) % k != 0) cout << s[k];
        cout << "\n";
      } else {
        cout << s[0];
        for (int i = k; i < n; i++) cout << s[i];
        cout << "\n";
      }
    }
  }
  return 0;
}
