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