#include <bits/stdc++.h>
using namespace std;
int main() {
  int test;
  scanf("%d", &test);
  while (test--) {
    int k, n;
    string ans = "", s;
    scanf("%d%d", &n, &k);
    cin >> s;
    sort(s.begin(), s.end());
    if (s[k - 1] != s[0]) {
      printf("%c\n", s[k - 1]);
      continue;
    }
    ans += s[0];
    if (s[k] == s[n - 1]) {
      int t = (n - k) / k;
      if ((n - k) % k == 0) t--;
      for (int i = k; i <= t + k; i++) ans += s[i];
    } else {
      for (int i = k; i < n; i++) ans += s[i];
    }
    cout << ans << endl;
  }
}
