#include <bits/stdc++.h>
using namespace std;
const int maxn = 100500;
const int inf = 0x3f3f3f3f;
int b[27];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int tn;
  cin >> tn;
  while (tn--) {
    memset(b, 0, sizeof(b));
    string s;
    int k, n;
    cin >> n >> k;
    cin >> s;
    sort(s.begin(), s.end());
    bool b = 1;
    for (int i = k; s[i + 1]; i++) {
      if (s[i] != s[i + 1]) {
        b = 0;
        break;
      }
    }
    if (s[0] == s[k - 1]) {
      cout << s[0];
      if (!b) {
        for (int i = k; s[i]; i++) cout << s[i];
        cout << "\n";
      } else {
        int ct = n - k;
        for (int i = 1; i <= ct / k; i++) cout << s[k];
        if (ct % k) cout << s[k];
        cout << "\n";
      }
    } else {
      for (int i = k - 1; i > 0; i--)
        if (s[i] != s[0]) {
          cout << s[i] << "\n";
          break;
        }
    }
  }
}
