for i in range(int(input())): k = int(input()) s = input() l = len(s) if k >= l: print(s[0] * l) else: print(s[0] * k + s[:l-k])