#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int t;
  t = 1;
  cin >> t;
  while (t--) {
    long long int i, j, k, temp, m, n, count = 0, flag, b, val;
    long long int x, sum = 0, pos, odd = 0, even = 0, start, y;
    cin >> n >> k;
    string data;
    cin >> data;
    flag = 0;
    sort(data.begin(), data.end());
    char c = data[0];
    count = 0;
    for (auto x : data) {
      if (x == c) {
        count++;
      } else {
        break;
      }
    }
    if (k > count) {
      cout << data[k - 1] << endl;
      continue;
    }
    cout << data[0];
    if (data[k] != data[n - 1]) {
      for (i = k; i < n; i++) {
        cout << data[i];
      }
    } else {
      for (i = 0; i < (n - 1) / k; i++) {
        cout << data[k];
      }
    }
    cout << endl;
  }
  return 0;
}
