t = int(input()) for i in range(t): input() v = [int(x) for x in input().split()] mx = max(v) print(' '.join(str(x) for x in v if x == mx))