#include <bits/stdc++.h>
using namespace std;
string s;
int n, k;
string arr[100001];
bool same1() {
  char c = s[0];
  for (int i = 0; i < k; i++)
    if (s[i] != c) return false;
  return true;
}
bool same2() {
  char c = s[k];
  for (int i = k; i < n; i++)
    if (s[i] != c) return false;
  return true;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long test = 1;
  cin >> test;
  while (test--) {
    cin >> n >> k;
    cin >> s;
    sort(s.begin(), s.end());
    for (int i = 0; i < k; i++) {
      arr[i] = "";
      arr[i] += s[i];
    }
    if (!same2() || !same1()) {
      if (!same1()) {
        cout << arr[k - 1] << "\n";
      } else
        cout << arr[0] + s.substr(k, n - k) << "\n";
      continue;
    } else {
      string tmp = "";
      int i = k;
      while (i < n) {
        arr[i % k] += s[i];
        tmp = max(tmp, arr[i % k]);
        i++;
      }
      cout << arr[0] << "\n";
    }
  }
  return 0;
}
