import sys input = sys.stdin.readline T=int(input()) for tests in range(T): N=int(input()) S=input().strip() # Z algorithm # https://snuke.hatenablog.com/entry/2014/12/03/214243 LEN=len(S) i=1 j=0 A=[0]*LEN A[0]=LEN while i