import sys input = sys.stdin.readline T=int(input()) for tests in range(T): K=int(input()) S=input().strip() if K>len(S): print(S[0]*len(S)) else: LEN=len(S) ANS=S[0]*K+S print(ANS[:LEN])