#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
long long fastpower(long long x, long long n) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return fastpower((x * x), n / 2);
  else
    return (x * fastpower((x * x), (n - 1) / 2));
}
long long GCD(long long A, long long B) {
  if (B == 0)
    return A;
  else
    return GCD(B, A % B);
}
bool vowl(char c) {
  return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u';
}
long long modInverse(long long A, long long M) { return fastpower(A, M - 2); }
void sieve(long long N) {
  bool isPrime[N + 1];
  for (long long i = 0; i <= N; ++i) {
    isPrime[i] = true;
  }
  isPrime[0] = false;
  isPrime[1] = false;
  for (long long i = 2; i * i <= N; ++i) {
    if (isPrime[i] == true) {
      for (long long j = i * i; j <= N; j += i) isPrime[j] = false;
    }
  }
}
vector<long long> factorize(long long n) {
  vector<long long> res;
  for (long long i = 2; i * i <= n; ++i) {
    while (n % i == 0) {
      res.push_back(i);
      n /= i;
    }
  }
  if (n != 1) {
    res.push_back(n);
  }
  return res;
}
void solve() {
  long long n, k;
  cin >> n >> k;
  string ans[k + 3];
  string p;
  cin >> p;
  for (long long i = 0; i < k + 1; i++) ans[i] = "";
  map<long long, long long> m;
  for (int i = 0; i < n; i++) {
    m[p[i] - 'a']++;
  }
  long long i;
  long long cont = 0;
  set<string> st;
  for (long long i = 0; i < 26;) {
    if (cont >= k) break;
    if (m[i]) {
      m[i]--;
      ans[cont] = "";
      ans[cont] += i + 'a';
      cont++;
    } else
      i++;
  }
  cont = 0;
  sort(ans, ans + k);
  for (int i = 0; i < 26; i++)
    if (m[i]) cont++;
  for (int i = 0; i < k; i++) st.insert(ans[i]);
  if (cont <= 1 && st.size() == 1) {
    int cont = 0;
    int total = n - k;
    while (total) {
      for (int i = 0; i < 26 && cont < k && total;) {
        if (m[i]) {
          m[i]--;
          ans[cont] += (i + 'a');
          total--;
          cont++;
        } else
          i++;
      }
      cont = 0;
    }
  } else {
    for (int i = 0; i < 26; ++i) {
      for (int j = 0; j < m[i]; ++j) {
        ans[0] += (i + 'a');
      }
    }
  }
  sort(ans, ans + k);
  cout << ans[k - 1] << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
