#include <bits/stdc++.h>
using namespace std;
signed 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 freq[26] = {0};
    int least = 26, ma = -1;
    for (auto x : s) {
      freq[x - 'a']++;
      least = min(least, x - 'a');
      ma = max(ma, x - 'a');
    }
    int i, j, used[26] = {0}, count = 0, last_used;
    for (i = 0, j = 0; i < k; i++) {
      if (!freq[j])
        i--, j++;
      else {
        used[j]++;
        last_used = j;
        if (least == j) count++;
        freq[j]--;
        while (j < 26 && !freq[j]) j++;
      }
    }
    if (last_used != least) {
      cout << char(last_used + 'a');
      cout << "\n";
    } else if (j == ma) {
      cout << char(least + 'a');
      int req = (freq[j] + count - 1) / count;
      while (req--) cout << char(ma + 'a');
      cout << "\n";
    } else {
      cout << char(least + 'a');
      for (int j = 0; j < 26; j++) {
        while (freq[j]--) {
          cout << char(j + 'a');
        }
      }
      cout << "\n";
    }
  }
  return 0;
}
