/*
手玩資料,會發現,你找不出可以進行超過兩次操作的字串,大膽假設,加上題目裡怪異的k <= 10^18,把k限制在2以內
就沒了
*/
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;
int n, len;
LL m;
string s;
string make(string s1)
{
string s2;
int len = s1.size();
for (int i = 0; i < len; i ++ )
{
if (i == 0 || i == len - 1) s2 += s1[i];
else if (s[i - 1] != s[i + 1]) s2 += s1[i];
}
return s2;
}
int main()
{
int T, l;
cin >> T >> l;
while (T -- )
{
cin >> n >> m;
cin >> s;
len = s.size();
if (m > 2) m = 2;
while (m -- ) s = make(s);
cout << s << endl;
}
return 0;
}