#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c != '-' && (c < '0' || c > '9')) c = getchar();
  if (c == '-') f = -1, c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return f * x;
}
const int maxn = 3e5 + 7;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
int n, k;
char s[maxn];
int cnt[26];
void solve() {
  memset(cnt, 0, sizeof(cnt));
  n = read(), k = read();
  scanf("%s", s + 1);
  for (int i = 1; i <= n; ++i) cnt[s[i] - 'a']++;
  if (k == 1) {
    for (int i = 0; i < 26; ++i) {
      for (int j = 0; j < cnt[i]; ++j) printf("%c", char('a' + i));
    }
    puts("");
    return;
  }
  string ans;
  int mi = 0;
  for (int i = 0; i < 26; ++i)
    if (cnt[i]) {
      mi = i;
      break;
    }
  if (cnt[mi] < k) {
    int up = k;
    for (int i = 0; i < 26; ++i) {
      if (cnt[i] < up)
        up -= cnt[i];
      else
        return (void)printf("%c\n", char('a' + i));
    }
  }
  cnt[mi] -= k;
  ans += char('a' + mi);
  for (int i = mi; i < 26; ++i) {
    for (int j = 0; j < cnt[i]; ++j) ans += char('a' + i);
  }
  for (int i = 1;; ++i) {
    if (ans.size() <= i + 1) break;
    int j = 1;
    while (j < k && ans.back() == ans[i] && ans.size() > i + 1)
      ans.pop_back(), j++;
    if (j != k) break;
    if (ans.size() <= i + 1) break;
  }
  cout << ans << endl;
}
int main() {
  int T = read();
  while (T--) solve();
}
