#include <bits/stdc++.h>
using namespace std;
constexpr int MAXN = 1e6 + 7;
int t;
string s;
string tab[MAXN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  for (int xyz = 0; xyz < t; xyz++) {
    int n, k;
    cin >> n >> k;
    cin >> s;
    map<char, int> mapa;
    int ile = 0;
    sort(s.begin(), s.end());
    for (int i = 0; i <= n; i++) tab[i] = "";
    for (char c : s) {
      mapa[c]++;
      if (mapa[c] == 1) ile++;
    }
    if (ile == 1) {
      string result = "";
      int xd = (n / k) + ((n % k) > 0);
      for (char c : s) {
        result += c;
        xd--;
        if (xd == 0) break;
      }
      cout << result << "\n";
    } else {
      int pointer = 1;
      int fla = 3;
      for (char c = 'a'; c <= 'z'; c++) {
        if (fla == 1) {
          while (mapa[c] > 0) {
            tab[1] = tab[1] + c;
            mapa[c]--;
          }
        } else if (fla == 2) {
          while (mapa[c] > 0) {
            tab[k] = tab[k] + c;
            mapa[c]--;
          }
        } else {
          if (mapa[c] == 0) continue;
          if (mapa[c] < k) {
            while (mapa[c] > 0 && pointer <= k) {
              tab[pointer] = tab[pointer] + c;
              pointer++;
              mapa[c]--;
              while (mapa[c] <= 0 && pointer <= k) c++;
            }
            fla = 1;
          } else {
            while (mapa[c] > 0 && pointer <= k) {
              tab[pointer] = tab[pointer] + c;
              pointer++;
              mapa[c]--;
            }
            if (mapa[c] == 0 && ile == 2) {
              int xd = (mapa[s.back()] / k) + ((mapa[s.back()] % k) > 0);
              for (int ala = 0; ala < xd; ala++) tab[k] += s.back();
              break;
            }
            fla = 2;
            c--;
          }
        }
      }
      cout << tab[k] << "\n";
    }
  }
  return 0;
}
