#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    string ans = "";
    int A[26];
    for (int i = 0; i < 26; ++i) {
      A[i] = 0;
    }
    for (int i = 0; i < n; ++i) {
      A[s[i] - 'a']++;
    }
    vector<char> v;
    for (int i = 0; i < n; ++i) {
      v.push_back((char)s[i]);
    }
    sort(v.begin(), v.end());
    string a[k];
    for (int i = 0; i < k; ++i) {
      a[i] = "";
    }
    for (int i = 0; i < k; ++i) {
      a[i] += v[i];
      A[v[i] - 'a']--;
    }
    int diff = 0;
    for (int i = 0; i < 26; ++i) {
      if (A[i]) diff++;
    }
    if (a[k - 1] != a[0]) {
      cout << a[k - 1] << endl;
      continue;
    }
    if (diff == 1) {
      for (int i = 0; i < 26; i++) {
        if (A[i]) {
          if (A[i] % k == 0) {
            for (int j = 0; j < (A[i] / k); j++) {
              a[0] += (char)(i + 'a');
            }
          } else {
            for (int j = 0; j < (A[i] / k) + 1; j++) {
              a[0] += (char)(i + 'a');
            }
          }
        }
      }
      cout << a[0] << endl;
    } else {
      for (int i = k; i < n; i++) {
        a[0] += v[i];
      }
      cout << a[0] << endl;
    }
  }
}
