#include <bits/stdc++.h>
using namespace std;
void file() {}
const long long nax = 2e5 + 1, mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  file();
  int testCases = 1;
  cin >> testCases;
  while (testCases--) {
    int n, k;
    string s;
    cin >> n >> k;
    cin >> s;
    sort(s.begin(), s.end());
    int first = s.front();
    if (first != s[k - 1]) {
      cout << s[k - 1] << "\n";
      continue;
    }
    string ans;
    ans += s.front();
    set<char> st;
    for (long long i = k; i <= n - 1; i++) {
      st.insert(s[i]);
      ans += s[i];
    }
    if (st.size() == 1) {
      int itr = 0;
      ans.clear();
      while (itr < n) {
        ans += s[itr];
        itr += k;
      }
      cout << ans << "\n";
      continue;
    }
    cout << ans << "\n";
  }
  return 0;
}
