#include <bits/stdc++.h>
using namespace std;
int t, n, k;
string s;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n >> k;
    vector<string> v(k), v1(k);
    for (int i = 0; i < k; i++) v[i] = v1[i] = "";
    cin >> s;
    sort(s.begin(), s.end());
    if (k == 1) {
      cout << s << '\n';
      continue;
    }
    if (k == n) {
      cout << s[n - 1] << '\n';
      continue;
    }
    for (int i = 0; i < k; i++) v[i] += s[i], v1[i] += s[i];
    for (int i = k; i < n; i++) v[0] += s[i], v1[i % k] += s[i];
    sort(v.begin(), v.end()), sort(v1.begin(), v1.end());
    cout << min(v[k - 1], v1[k - 1]) << '\n';
  }
}
