#include <bits/stdc++.h>
using namespace std;
void solve();
string conc(long long int a, long long int b) {
  return to_string(a) + "|" + to_string(b);
}
long long int rev(long long int x) {
  long long int ans = 0;
  while (x != 0) {
    ans = ans * 10 + (x % 10);
    x /= 10;
  }
  return ans;
}
long long int numdig(long long int x) {
  long long int ans = 0;
  while (x != 0) {
    ans++;
    x /= 10;
  }
  return ans;
}
void printvec(vector<long long int> &v) {
  for (long long int i = 0; i < v.size(); i++) cout << v[i] << " ";
  cout << "\n";
}
void printmat(vector<vector<long long int>> &mat) {
  for (long long int i = 0; i < mat.size(); i++) {
    for (long long int j = 0; j < mat[0].size(); j++) cout << mat[i][j] << " ";
    cout << "\n";
  }
}
void solve() {
  long long int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<long long int> f(26, 0);
  vector<pair<char, long long int>> v;
  long long int vsize = 0;
  for (auto c : s) f[c - 'a']++;
  for (long long int i = 0; i < 26; i++) {
    if (f[i] > 0) {
      v.push_back({'a' + i, f[i]});
      vsize++;
    }
  }
  if (v[0].second < k) {
    long long int count = 0;
    for (long long int i = 0; i < vsize; i++) {
      count += v[i].second;
      if (count >= k) {
        cout << v[i].first << "\n";
        return;
      }
    }
    return;
  }
  string init = "";
  init = init + v[0].first;
  vector<string> words(k, init);
  v[0].second -= k;
  for (long long int i = 0; i < vsize; i++) {
    if (i == vsize - 1) {
      long long int j = 0;
      long long int c = 0;
      while (j < k && words[j] == words[0]) j++;
      while (v[i].second--) {
        words[c] += v[i].first;
        c = (c + 1) % j;
      }
    } else {
      while (v[i].second--) {
        words[0] += v[i].first;
      }
    }
  }
  sort(words.begin(), words.end());
  cout << words[k - 1] << "\n";
}
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
