#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define bug(a) cout << #a << " : " << a << endl;
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1; cin >> t;
while (t--) {
int n, m;cin >> n >> m;
string s;cin >> s;
string sorted_s = s;
sort(sorted_s.begin(), sorted_s.end());
vector<bool> swapped(n, false);
for (int i = 0; i < n && m > 0; ++i) {
if (s[i] == sorted_s[i]) continue;
for (int j = i + 1; j < n; ++j) {
if (s[j] == sorted_s[i] && !swapped[j]) {
swap(s[i], s[j]);
swapped[j] = true;
--m;
break;
}
}
}
cout << s << endl;
}
return 0;
}