for _ in range(int(input())): K = int(input()) S = input() if K < len(S): print(S[0]*K+S[:len(S)-K]) else: print(S[0]*len(S))