#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  if (k == n) {
    cout << s.back() << '\n';
    return;
  }
  string ans = "";
  char last = s[k - 1];
  if (s[0] == last) {
    ans.push_back(s[0]);
  } else {
    ans.push_back(last);
    cout << ans << '\n';
    return;
  }
  last = s.back();
  if (s[k] == last) {
    int cnt = n - k;
    cnt = (cnt + k - 1) / k;
    for (int i = 0, to = cnt; i < to; i++) ans.push_back(last);
  } else {
    for (int i = k, to = n; i < to; i++) ans.push_back(s[i]);
  }
  cout << ans << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
