#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string str;
    int n, k;
    cin >> n >> k;
    cin >> str;
    int a;
    sort(str.begin(), str.end());
    if (str[0] != str[k - 1]) {
      cout << str[k - 1] << "\n";
    } else {
      if (str[k] == str[n - 1]) {
        cout << str[0];
        if ((n - k) % k == 0) {
          for (int i = 1; i <= (n - k) / k; i++) {
            cout << str[n - 1];
          }
          cout << "\n";
        } else {
          for (int i = 0; i <= (n - k) / k; i++) {
            cout << str[n - 1];
          }
        }
        cout << "\n";
      } else {
        cout << str[0] << str.substr(k, n - 1) << "\n";
      }
    }
  }
}
