from heapq import heappush, heappop class MaxHeapQ(): def __init__(self): self.H = [] def hpush(self, x): heappush(self.H, -x) def hpop(self): return -heappop(self.H) def hmax(self): return -self.H[0] N = int(input()) A = [int(input()) for _ in range(N)] ANS = [-1] * N ans = 0 MH = [MaxHeapQ() for _ in range(2)] for i in range(0, N): H = MH[i%2] H.hpush(A[i-1]) H.hpop() A[i] ^= ans H.hpush(A[i]) ans = H.hmax() ANS[i] = ans print("\n".join(map(str, ANS)))