#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5;
char a[N];
void test() {
  long long n, k;
  cin >> n >> k;
  for (long long i = 0; i <= n - 1; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  if (a[k - 1] != a[0]) {
    cout << a[k - 1] << endl;
    return;
  }
  long long __count = 1;
  for (long long i = k + 1; i <= n - 1; i++) {
    if (a[i - 1] != a[i]) {
      __count++;
    }
  }
  if (__count == 1) {
    for (long long i = 0; i <= n - 1; i++) {
      if (i % k == 0) {
        cout << a[i];
      }
    }
    cout << endl;
    return;
  }
  for (long long i = k - 1; i <= n - 1; i++) {
    cout << a[i];
  }
  cout << endl;
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    test();
  }
}
