#include <bits/stdc++.h>
using namespace std;
const int maxx = 100010;
int n, k, t;
int ans = 0, total = 0, cnt = 0;
char s[maxx];
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d%d", &n, &k);
    scanf("%s", s);
    sort(s, s + n);
    printf("%c", s[k - 1]);
    if (s[0] == s[k - 1] && s[k] == s[n - 1]) {
      for (int i = 0; i < (n - 1) / k; i++) printf("%c", s[k]);
      printf("\n");
    } else if (s[0] == s[k - 1]) {
      for (int i = k; i <= n - 1; i++) printf("%c", s[i]);
      printf("\n");
    } else
      printf("\n");
  }
  return 0;
}
