import sys # for line in sys.stdin: # a = line.split() # print(int(a[0]) + int(a[1])) t = int(input()) for i in range(t): n = int(input()) s = str(input()) print(s[::-1])