#include <bits/stdc++.h>
using namespace std;
int main() {
  long t;
  cin >> t;
  while (t--) {
    long n, k;
    string s;
    cin >> n >> k;
    cin >> s;
    string ns = "";
    for (int i = 0; i < 26; i++) {
      for (int j = 0; j < n; j++) {
        if (s[j] == (i + 'a')) {
          ns += (i + 'a');
        }
      }
    }
    int f = 0;
    for (int i = 0; i < k - 1; i++) {
      if (ns[i] != ns[i + 1]) {
        f = 1;
      }
    }
    if (f == 1) {
      cout << ns[k - 1] << endl;
      continue;
    }
    int flag = 0;
    for (int i = k; i < n - 1; i++) {
      if (ns[i] != ns[i + 1]) {
        flag = 1;
      }
    }
    if (flag == 0) {
      int tot = n - k;
      int pr = 0;
      if (tot == 0) {
        pr = 0;
      } else if (tot <= k) {
        pr = 1;
      } else {
        pr = tot / k;
        if (tot % k > 0) {
          pr++;
        }
      }
      cout << ns[0];
      for (int i = 0; i < pr; i++) {
        cout << ns[k];
      }
      cout << endl;
    } else {
      for (int i = k - 1; i < n; i++) {
        cout << ns[i];
      }
      cout << endl;
    }
  }
  return 0;
}
