#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const int inf = 1e9;
char aa[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
      cin >> aa[i];
    }
    sort(aa + 1, aa + 1 + n);
    if (aa[1] != aa[k])
      cout << aa[k] << endl;
    else {
      int mark = 1;
      if (aa[n] == aa[k + 1]) mark = 0;
      if (mark == 0) {
        for (int i = 1; i <= n; i += k) cout << aa[i];
        cout << endl;
      } else {
        cout << aa[1];
        for (int i = k + 1; i <= n; i++) cout << aa[i];
        cout << endl;
      }
    }
  }
  return 0;
}
