#include <bits/stdc++.h>
using namespace std;
template <typename T>
void pop_front(std::vector<T> &v) {
  if (v.size() > 0) {
    v.erase(v.begin());
  }
}
template <typename R>
void pop_back(std::vector<R> &v) {
  if (v.size() > 0) {
    v.erase(v.begin() + v.size() - 1);
  }
}
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
long long int less_than_or_equal_to(vector<long long int> vec,
                                    long long int k) {
  sort(vec.begin(), vec.end());
  if (vec[0] > k)
    return -1;
  else if (vec[vec.size() - 1] < k)
    return vec[vec.size() - 1];
  auto x = lower_bound(vec.begin(), vec.end(), k);
  if (k == *x)
    return *x;
  else {
    x--;
    return *x;
  }
}
bool isPerfectSquare(long double x) {
  long double sr = sqrt(x);
  return ((sr - floor(sr)) == 0);
}
bool isprime(long long int n) {
  if (n <= 1) return false;
  for (long long int i = 2; i * i <= n; i++)
    if (n % i == 0) return false;
  return true;
}
void prime_factors(long long int n) {
  for (long long int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      long long int count = 0;
      while (n % i == 0) {
        count++;
        n = n / i;
      }
      cout << i << " "
           << "^"
           << " " << count << "\n";
    }
  }
  if (n > 1)
    cout << n << " "
         << "^"
         << " " << 1 << "\n";
}
vector<long long int> divisors(long long int n) {
  vector<long long int> v;
  for (long long int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      v.push_back(i);
      if ((n / i) != i) v.push_back(n / i);
    }
  }
  return v;
}
long long int power(long long int a, long long int n, long long int m) {
  long long int res = 1;
  while (n) {
    if (n % 2)
      res = (res * a) % m, n--;
    else
      a = (a * a) % m, n /= 2;
  }
  return res;
}
long long int ts(long long int arr[], int l, int r, int x) {
  while (l <= r) {
    long long int mid1 = l + (r - l) / 3;
    long long int mid2 = r - (r - l) / 3;
    if (arr[mid1] == x || arr[mid2] == x) return 1;
    if (x < arr[mid1])
      r = mid1 - 1;
    else if (x > arr[mid2])
      l = mid2 + 1;
    else {
      l = mid1 + 1;
      r = mid2 - 1;
    }
  }
  return -1;
}
long long int modulo_inverse(long long int a, long long int m) {
  long long int res = power(a, m - 2, m);
  return res;
}
long long int Euler_totient(long long int n) {
  vector<long long int> primes;
  long long int res = n;
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      res /= i;
      res *= (i - 1);
      primes.push_back(i);
      while (n % i == 0) n = n / i;
    }
  }
  if (n > 1) {
    res /= n;
    res *= (n - 1);
  }
  return res;
}
int main() {
  auto start = chrono::high_resolution_clock::now();
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int t = 1;
  cin >> t;
  while (t--) {
    long long int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if (s[0] != s[k - 1])
      cout << s[k - 1] << "\n";
    else {
      if (s[k] == s[n - 1]) {
        cout << s[0];
        int d = n - k;
        for (int i = 0; i < d / k; i++) cout << s[k];
        if (d % k != 0) cout << s[k];
        cout << "\n";
      } else {
        cout << s[0];
        for (int i = k; i < n; i++) cout << s[i];
        cout << "\n";
      }
    }
  }
  auto finish = chrono::high_resolution_clock::now();
  cerr << "Time elapsed: "
       << (chrono::duration<long double>(finish - start)).count() << "s\n";
  return 0;
}
