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