#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
const int N = 100005;
void solve() {
  long long n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<long long> cc(26, 0);
  vector<long long> poss;
  for (long long i = 0; i <= (long long)s.size() - 1; i++) {
    cc[s[i] - 'a']++;
  }
  for (long long i = 0; i <= 25; i++) {
    if (cc[i]) poss.push_back(i);
  }
  if (k == 1) {
    for (long long i = 0; i <= 25; i++) {
      for (long long j = 0; j <= cc[i] - 1; j++) cout << (char)(i + 'a');
    }
    cout << '\n';
    return;
  }
  if (cc[poss[0]] < k) {
    long long curr = 0;
    for (long long i = 0; i <= (long long)poss.size() - 1; i++) {
      if ((cc[poss[i]] + curr) >= k) {
        cout << (char)(poss[i] + 'a') << '\n';
        return;
      } else {
        curr += cc[poss[i]];
      }
    }
  }
  string ans = "";
  ans.push_back((char)(poss[0] + 'a'));
  cc[poss[0]] -= k;
  for (long long i = 0; i <= (long long)poss.size() - 1; i++) {
    if (cc[poss[i]] == 0) continue;
    if (i != ((long long)poss.size() - 1)) {
      for (long long k = i; k <= (long long)poss.size() - 1; k++) {
        for (long long j = 0; j <= cc[poss[k]] - 1; j++)
          ans.push_back((char)(poss[k] + 'a'));
      }
      break;
    } else {
      if (cc[poss[i]] % k == 0) {
        for (long long j = 1; j <= cc[poss[i]] / k; j++)
          ans.push_back((char)(poss[i] + 'a'));
      } else {
        for (long long j = 1; j <= cc[poss[i]] / k; j++)
          ans.push_back((char)(poss[i] + 'a'));
        for (long long j = 1; j <= 1; j++) ans.push_back((char)(poss[i] + 'a'));
      }
    }
  }
  cout << ans << '\n';
  return;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  cin >> TESTS;
  while (TESTS--) {
    solve();
  }
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}
