TT = int(input()) for loop in range(TT): K = int(input()) S = input() R = S[:len(S)-K] L = S[0] * (len(S)-len(R)) print (L+R)