#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;
map<char,set<int>>mp;
for(int i=0;i<n;i++){
mp[s[i]].insert(i);
}
// for(auto i:mp){
// for(auto j:i.second)cout<<j<<' ';
// cout<<endl;
// }
string tmp=s;
sort(tmp.begin(),tmp.end());
// cout<<tmp<<endl;
int i=0;
while(m and i<n){
if(s[i]!=tmp[i]){
auto it = --mp[tmp[i]].end();
// bug(x)
int x=*it;
int a=i;
mp[s[i]].erase(i);
mp[tmp[i]].erase(x);
swap(s[i],s[x]);
m--;
// mp[s[i]]
mp[s[i]].insert(i);
mp[s[x]].insert(x);
}
i++;
}
cout<<s<<endl;
}
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);
}
}