t=int(input())
for i in range(t):
    n=int(input())
    s=input()
    reverse_str=s[::-1]
    print(reverse_str)