#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
template <class T>
inline void amin(T &x, const T &y) {
  if (y < x) x = y;
}
template <class T>
inline void amax(T &x, const T &y) {
  if (x < y) x = y;
}
template <class Iter>
void rprintf(const char *fmt, Iter begin, Iter end) {
  for (bool sp = 0; begin != end; ++begin) {
    if (sp)
      putchar(' ');
    else
      sp = true;
    printf(fmt, *begin);
  }
  putchar('\n');
}
int N, K;
char S[100011];
int C[26];
void MAIN() {
  scanf("%d%d%s", &N, &K, S);
  sort(S, S + N);
  if (K == 1) {
    puts(S);
    return;
  }
  memset(C, 0, sizeof C);
  for (int i = 0, i_len = (N); i < i_len; ++i) C[S[i] - 'a']++;
  vector<pair<int, char> > V;
  for (int i = 0, i_len = (26); i < i_len; ++i)
    if (C[i]) {
      V.emplace_back(C[i], i + 'a');
    }
  if (V.size() == 1u) {
    for (int a = 0, a_len = ((N + K - 1) / K); a < a_len; ++a) putchar(S[0]);
    putchar('\n');
    return;
  }
  if (V.size() == 2u && V[0].first == K) {
    putchar(V[0].second);
    for (int a = 0, a_len = ((N - 1) / K); a < a_len; ++a) putchar(V[1].second);
    putchar('\n');
    return;
  }
  if (V[0].first < K) {
    putchar(S[K - 1]);
    putchar('\n');
    return;
  }
  puts(S + K - 1);
}
int main() {
  int TC = 1;
  scanf("%d", &TC);
  for (int tc = 0, tc_len = (TC); tc < tc_len; ++tc) MAIN();
  return 0;
}
