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