from functools import reduce for _ in range(int(input())): input() b=list(map(int,input().split())) print(reduce(lambda x, y: x ^ y, b, 0))