#include <bits/stdc++.h>
using namespace std;
#define SC scanf
#define PF printf
#define ull unsigned long long
#define ld long double
#define F first
#define S second
#define pb push_back
#define sort_a(a) sort(a.begin(),a.end());
#define sort_d(a) sort(a.rbegin(),a.rend());
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
#define rev(s) reverse(s.begin(),s.end())
#define P(ok) cout << (ok ? "YES\n": "NO\n")
#define __Heart__ ios_base :: sync_with_stdio(false); cin.tie(NULL);
#define ll long long
typedef pair< ll , ll> PII;
char indexToChar(int index) {
return 'a' + index;
}
void solve()
{
int n , m , freq[26] ; cin >> n >> m ;
for(int i = 0 ; i < 26 ; i++) freq[i] = 0 ;
string s ; cin >> s ;
map < int , vector < int > > mp ;
set < int > st ;
for(int i = 0 ; i < n ; i++){
int ch = s[i] - 'a' ;
freq[ch]++ ;
mp[ch].pb(i) ;
st.insert(ch) ;
}
for(auto it : st){
if(!m) break ;
for(int i = 0; i < n && m ; i++){
int ch = s[i]- 'a' ;
if(it >= ch ) continue ;
vector < pair <int , int > > v ;
while(freq[it] && i < n && m){
ch = s[i]- 'a' ;
if(it >= ch) i++ ;
else{
freq[it]-- , m-- ;
v.pb({ch , i}) ;
i++ ;
}
}
sort_a(v) ;
//for(auto it : v) cout << it.F ; cout << endl ;
int j = 0 ;
for(auto kt : mp[it]){
if(j == v.size()) break ;
if(kt > v[j].S) swap(s[kt] , s[v[j++].S]) ;
}
}
}
cout << s << "\n" ;
}
int main()
{
__Heart__
int t ; cin >> t ; while(t--) solve() ;
}