#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    string s;
    vector<char> ans;
    int sig = 1;
    cin >> s;
    sort(s.begin(), s.end());
    ans.push_back(s[k - 1]);
    if (s[k - 1] != s[0] && k != 1)
      cout << s[k - 1] << "\n";
    else {
      if (k == 1) {
        cout << s << "\n";
      } else {
        s.erase(0, k - 1);
        int temp = s.size();
        if (s[1] != s[temp - 1])
          cout << s << "\n";
        else {
          cout << s[0];
          for (int i = 1; i < temp; ++i) {
            if (i % k == 1) cout << s[i];
          }
          cout << "\n";
        }
      }
    }
  }
}
