#include <bits/stdc++.h>
using namespace std;
void solve() {
  int length, no_of_substrings;
  cin >> length >> no_of_substrings;
  string S;
  cin >> S;
  sort((S).begin(), (S).end());
  if (S[no_of_substrings - 1] != S[0]) {
    cout << S[no_of_substrings - 1] << "\n";
    return;
  }
  string answer;
  set<char> distinct;
  for (int i = no_of_substrings; i < length; i++) {
    distinct.insert(S[i]);
  }
  if (distinct.size() > 1) {
    for (int i = no_of_substrings - 1; i < length; i++) {
      answer += S[i];
    }
  } else {
    for (int i = no_of_substrings - 1; i < length; i += no_of_substrings) {
      answer += S[i];
    }
    if ((length - 1) % no_of_substrings != no_of_substrings - 1) {
      answer += S.back();
    }
  }
  cout << answer << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int no_of_test_cases;
  cin >> no_of_test_cases;
  while (no_of_test_cases--) solve();
  return 0;
}
