t = int(input()) for _ in range(t): k = int(input()) s = input() for i in range(min(k, len(s))): s = s[0] + s s = s[:-1] print(s)