#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
const long long INF = LLONG_MAX / 2;
const long long N = 1e4;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    char last = s[n - 1];
    vector<string> a(k);
    for (long long i = 0; i < k; i++) a[i].append(1, s[i]);
    long long i = k, j = 0;
    if (count(a.begin(), a.end(), a[0]) == k && s[i] == last)
      while (i < n) {
        a[j % k].append(1, s[i]);
        i++;
        j++;
      }
    else
      a[j].append(s.substr(k, n - k));
    cout << *max_element(a.begin(), a.end()) << '\n';
  }
  return 0;
}
