#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s = "";
    set<char> ch;
    int a[26] = {0};
    char c;
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
      cin >> c;
      ch.insert(c);
      a[c - 'a']++;
    }
    auto it = ch.begin();
    if (a[(*it) - 'a'] < k) {
      while (1) {
        if (a[(*it) - 'a'] < k)
          k -= a[(*it) - 'a'];
        else {
          s += (*it);
          break;
        }
        it++;
      }
    } else {
      s += (*it);
      a[(*it) - 'a'] -= k;
      int i = 2;
      auto itr = it;
      itr++;
      while (i-- && it != ch.end()) {
        if (a[(*it) - 'a'] && itr != ch.end())
          break;
        else if (itr == ch.end()) {
          while (a[(*it) - 'a'] / k) {
            s += (*it);
            a[(*it) - 'a'] -= k;
          }
          if (a[(*it) - 'a']) s += (*it);
        }
        itr++;
        it++;
      }
      while (it != ch.end()) {
        while (a[(*it) - 'a']--) s += (*it);
        it++;
      }
    }
    cout << s << endl;
  }
}
