n = int(eval(input()))

A = list(map(int,input().split()))

B = [0]*30

ans = []

for i in A:

    for j in range(30):

        if (i>>j) & 1:

            B[j] += 1

for i in A:

    C = [c for c in B]

    for j in range(30):

        if (i>>j) & 1:

            C[j] -= 1

    a = 0

    for j in range(30):

        if C[j]%2 == 1:

            a += 2**(j)

    ans.append(str(a))

print((" ".join(ans)))
n = int(input())

A = list(map(int,input().split()))

s = A[0]

for i in range(1,n):

    s ^= A[i]

for i in A:

    print(s^i,end=" ")

print("\n")

n = int(eval(input()))
A = list(map(int, input().split()))
B = [0] * 30
ans = []
for i in A:
    for j in range(30):
        if (i >> j) & 1:
            B[j] += 1
for i in A:
    C = [c for c in B]
    for j in range(30):
        if (i >> j) & 1:
            C[j] -= 1
    a = 0
    for j in range(30):
        if C[j] % 2 == 1:
            a += 2 ** (j)
    ans.append(str(a))
print((" ".join(ans)))

n = int(input())
A = list(map(int, input().split()))
s = A[0]
for i in range(1, n):
    s ^= A[i]
for i in A:
    print(s ^ i, end=" ")
print("\n")

-n = int(eval(input())) +n = int(input()) -B = [0] * 30 -ans = [] +s = A[0] +for i in range(1, n): +    s ^= A[i] -    for j in range(30): -        if (i >> j) & 1: -            B[j] += 1 -for i in A: -    C = [c for c in B] -    for j in range(30): -        if (i >> j) & 1: -            C[j] -= 1 -    a = 0 -    for j in range(30): -        if C[j] % 2 == 1: -            a += 2 ** (j) -    ans.append(str(a)) -print((" ".join(ans))) +    print(s ^ i, end=" ") +print("\n")