#include <bits/stdc++.h>
using namespace std;
const int MSIZE = 1e3 + 5;
const int MOD = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    int cnt[26] = {0};
    for (char c : s) cnt[c - 'a']++;
    int os = 0;
    for (int i = 0; i <= 25; i++) {
      if (cnt[i] >= k - os) {
        cnt[i] -= (k - os);
        cout << (char)('a' + i);
        break;
      }
      os += cnt[i];
      cnt[i] = 0;
    }
    if (os) {
      cout << endl;
      continue;
    }
    bool pr = 0;
    for (int i = 0; i <= 25; i++) {
      if (cnt[i] and cnt[i] == n - k) {
        int val = cnt[i] / k + (cnt[i] % k != 0);
        while (val--) cout << (char)('a' + i);
        break;
      }
      while (cnt[i]--) cout << (char)('a' + i);
    }
    cout << endl;
  }
  return 0;
}
