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