#include <bits/stdc++.h>
using namespace std;
const int MXN = 1e5 + 5;
vector<char> v;
void solve() {
  int i, j, t, k;
  string str, res = "", ress = "";
  cin >> t >> k >> str;
  vector<char> v[k];
  vector<char> vv[k];
  sort(str.rbegin(), str.rend());
  int pos = 0, c = 1;
  for (i = t - 1; i >= 0; i--) {
    v[pos].push_back(str.back());
    if (c) vv[pos].push_back(str.back());
    str.pop_back();
    pos = pos + 1;
    if (pos == k && c) {
      string temp = str;
      sort(temp.begin(), temp.end());
      c = 0;
      for (auto j : temp) vv[0].push_back(j);
    }
    pos %= k;
  }
  vector<string> v2, vv2;
  for (i = 0; i < k; i++) {
    string st = "";
    for (j = 0; j < v[i].size(); j++) st += v[i][j];
    v2.push_back(st);
    st = "";
    for (j = 0; j < vv[i].size(); j++) st += vv[i][j];
    vv2.push_back(st);
  }
  sort(v2.begin(), v2.end());
  sort(vv2.begin(), vv2.end());
  cout << min(v2[v2.size() - 1], vv2[vv2.size() - 1]) << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int test;
  cin >> test;
  while (test--) solve();
  return 0;
}
