t = int(input()) for i in range(t): n = int(input()) s = input().strip() print("".join(s[:n].split())[::-1])