#include <bits/stdc++.h>
using namespace std;
inline void solve() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  int ar[30] = {};
  int last = 0;
  for (auto c : s) {
    ar[c - 'a']++;
    last = max(last, c - 'a');
  }
  vector<string> v(k);
  for (int i = 0, j = 0; i < k; i++) {
    while (ar[j] == 0) j++;
    ar[j]--;
    v[i].push_back('a' + j);
  }
  sort(v.begin(), v.end());
  if (v[0] != v.back()) {
    cout << v.back() << endl;
    return;
  }
  for (int i = 0; i < 26; i++) {
    for (int j = 0; ar[i]; j = (j + 1) % k, ar[i]--) {
      if (last == i)
        v[j].push_back('a' + i);
      else
        v[0].push_back('a' + i), last = -1;
    }
  }
  cout << v[0] << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
}
