#include #include #include #include #include using namespace std; const int Maxn = 1010; char s[Maxn], st[Maxn]; bitset <2000> f[Maxn]; int n, m; int main (){ int i, j, k; int T; scanf ( "%d", &T ); while ( T -- ){ scanf ( "%d%d", &n, &m ); scanf ( "%s", s+1 ); if ( n % 2 == 1 ){ printf ( "Impossible\n" ); continue; } f[n/2+1].reset (); f[n/2+1][0] = 1; for ( i = n/2; i >= 1; i -- ){ f[i].reset (); if ( s[i] != s[i+n/2] ) f[i] = f[i] | (f[i+1]<<1); else f[i] = f[i] | f[i+1]; f[i] = f[i] | (f[i+1]<<2); } if ( f[1][m] == 0 ){ printf ( "Impossible\n" ); continue; } for ( i = 1; i <= n/2; i ++ ){ for ( j = 'a'; j <= 'z'; j ++ ){ int ret = 0; if ( s[i] != j ) ret ++; if ( s[i+n/2] != j ) ret ++; if ( m-ret >= 0 ){ if ( f[i+1][m-ret] == 1 ){ st[i] = st[i+n/2] = j; m -= ret; break; } } } } for ( i = 1; i <= n; i ++ ) printf ( "%c", st[i] ); printf ( "\n" ); } return 0; }