#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define bug(a) cout<< #a << " : " << a <<endl;
#define bug2(a, b) cout<< #a << " : " << a << " " << #b << " : " << b << endl;
void solve(int cs){
int n,m;
cin >> n >> m;
string s; cin >> s;
set<int> v[30];
if(m >= n){
sort(s.begin(),s.end());
cout << s << '\n';
return;
}
for(int i = 0; i < n; i++){
v[s[i] - 'a'].insert(i);
}
string ans = "";
int cur = 0;
while(m and ans.size() < n){
for(auto &u : v){
if(u.size() == 0)continue;
while(u.size()){
int i = *u.begin();
u.erase(u.begin());
//bug(i);
if(s[i] == s[cur]){
ans += s[i];
cur++;
}else{
m--;
ans += s[i];
v[s[cur] - 'a'].erase(cur);
v[s[cur] - 'a'].insert(i);
swap(s[i],s[cur]);
}
}
}
}
int baki = n - ans.size();
if(baki > 0 )ans += s.substr(ans.size(),baki);
cout << ans << '\n';
}
int main(){
ios_base::sync_with_stdio(false);cin.tie(0);
cout.tie(0);
int tc = 1;
cin >> tc;
for(int cs = 1; cs <= tc; cs++){
solve(cs);
}
}