#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long mod = 1e9 + 7;
int main() {
  int t;
  cin >> t;
  int n, k;
  string S;
  string ans;
  int same, minnum;
  for (int i = 0; i < t; ++i) {
    minnum = 0;
    same = 0;
    cin >> n >> k;
    cin >> S;
    sort(S.begin(), S.end());
    ans = S.substr(k - 1);
    for (int j = 0; j < k; ++j) {
      if (ans[0] == S[j])
        same++;
      else
        minnum++;
    }
    if (minnum > 0)
      ans = ans[0];
    else {
      if (ans.size() > 2) {
        if (ans[1] == ans[ans.size() - 1]) {
          if ((ans.size() - 1) % same == 0) {
            ans = ans[0] + ans.substr(1, (ans.size() - 1) / same);
          } else
            ans = ans[0] + ans.substr(1, (ans.size() - 1) / same + 1);
        }
      }
    }
    cout << ans << endl;
  }
}
