Problem:
 Score : 500 points    Problem Statement There are N Snuke Cats numbered 1, 2, \ldots, N , where N is even .  Each Snuke Cat wears a red scarf, on which his favorite non-negative integer is written.  Recently, they learned the operation called xor (exclusive OR).   What is xor?  For n non-negative integers x_1, x_2, \ldots, x_n , their xor, x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is defined as follows:  When x_1~\textrm{xor}~x_2~\textrm{xor}~\ldots~\textrm{xor}~x_n is written in base two, the digit in the 2^k 's place ( k \geq 0 ) is 1 if the number of integers among x_1, x_2, \ldots, x_n whose binary representations have 1 in the 2^k 's place is odd, and 0 if that count is even.  For example, 3~\textrm{xor}~5 = 6 .   They wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf.  We know that the xor calculated by Snuke Cat i , that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i .
Using this information, restore the integer written on the scarf of each Snuke Cat.      Constraints  All values in input are integers.  2 \leq N \leq 200000  N is even .  0 \leq a_i \leq 10^9  There exists a combination of integers on the scarfs that is consistent with the given information.         Input Input is given from Standard Input in the following format:  N  a_1  a_2  \ldots  a_N       Output Print a line containing N integers separated with space.  The i -th of the integers from the left should represent the integer written on the scarf of Snuke Cat i .  If there are multiple possible solutions, you may print any of them.        Sample Input 1 4
20 11 9 24      Sample Output 1 26 5 7 22   5~\textrm{xor}~7~\textrm{xor}~22 = 20  26~\textrm{xor}~7~\textrm{xor}~22 = 11  26~\textrm{xor}~5~\textrm{xor}~22 = 9  26~\textrm{xor}~5~\textrm{xor}~7 = 24   Thus, this output is consistent with the given information.

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

x_1_n = 0
for a_i in a:
    x_1_n ^= a_i

for a_i in a:
    print(-1 - ~(x_1_n ^ a_i))

Solution (Python):
ans = ""
n = int(input())
l = list(map(int, input().split()))
s = 0
for a in l:
  s ^= a
for a in l:
  ans += str(s^a) + " "
print(ans[:-1])

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
s = 0

for i in a:
    s = s ^ i

for i in a:
    print(i ^ s)

Solution (Python):


n = int(input())
a = list(map(int, input().split()))
ans=a[0]

for i in range(1,n):
    ans = ans ^ a[i]

b = []
for i in range(n):
    b.append(ans ^ a[i])
print(*b)

Solution (Python):
N = int(input())
a = input().split()
a = [int(x) for x in a]

s = 0
for x in a:
  s = s^x

L = []

for x in a:
  L.append(str(int(x^s)))

print(" ".join(L))

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

Solution (Python):
N = int(input())
A = list(map(int,input().split()))

from functools import reduce

def func(x,y):
    return x^y

all_ = reduce(func,A)

li = [0]*N

for i,a in enumerate(A):
    li[i]=a^all_

print(*li)

Solution (Python):
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n=ni()
a=nl()

s = 0

for i in range(n):
  s ^= a[i]
for i in range(n):
  a[i] ^= s
  print(a[i])

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
p=0
for i in l:
    p^=i
ans=[]
for i in l:
    ans.append(p^i)
print(*ans)

Solution (Python):
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

def xor(x,y):
    return x^y

N = i()
A = l()
ans = []
S = xor(A[0],A[1])

for i in range(len(A)-2):
    S = xor(S,A[i+2])

for i in A:
    ans.append(str(xor(S,i)))

print(" ".join(ans))

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
def xor(x,y):
    return x^y
S=xor(A[0],A[1])
for i in range(len(A)-2):
    S=xor(S,A[i+2])
ans=[]
for a in A:
    ans.append(xor(S,a))
print(*ans)

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
x=l[0]
xx=[]
for i in l[1:]:
  x^=i
for i in l:
  xx.append(x^i)
print(*xx)

Solution (Python):
n = input()
a = list(map(int,input().split()))
s = 0
for v in a: s ^= v
for v in a: print(s^v)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
s = 0
for v in a:
  s ^= v
for v in a:
  print(s^v)

Solution (Python):
n = int(input())
nums = list(map(int, input().split()))

xors = 0

for num in nums:
  xors = xors ^ num

for i in range(n):
  nums[i] = str(nums[i] ^ xors)

print(" ".join((nums)))

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
S = a[0]
for v in a[1:]:
  S = S^v
for v in a:
  print(S^v)

Solution (Python):

import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

q = I()
mylist = LI()
result = 0
for i in mylist:
    result = result ^ i

for i in mylist:
    print(result ^ i)

Solution (Python):
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

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

    S = 0
    for a in A:
        S ^= a
    B = []
    for a in A:
        B.append(a^S)
    print(*B)


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
a = list(map(int, input().split()))

s = a[0]
for i in range(N - 1):
    s ^= a[i + 1]

b = [s ^ a[i] for i in range(N)]
print(*b)

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
S=0
for i in a:
  S^=i
a=[S^i for i in a]  
print(*a)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
xor = 0
for i in a:
    xor ^= i
print(*[xor ^ i for i in a])

Solution (Python):
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy

def main():
    n = int(input())
    a = list(map(int,input().split()))
    b = a[0]
    for i in range(1,n):
        b = b^a[i]
    ans = []
    for i in range(n):
        ans.append(b^a[i])
    print(*ans)
if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
xor_arr = list(map(int, input().split()))
xor_of_xor = 0
for elm in xor_arr:
    xor_of_xor = xor_of_xor ^ elm
scarf_val = [xor_of_xor ^ elm for elm in xor_arr]
         
print(" ".join(str(x) for x in scarf_val))

Solution (Python):
import sys
import math


input = sys.stdin.readline
 

def inp():
    return(int(input()))
def inara():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))



n=inp()
ara=inara()

xor=0
for num in ara:
	xor^=num

xor^=ara[n-1]

ans=[0]*n
ans[n-1]=xor

for i in range(n-2,-1,-1):
	xor^=ara[i]^ara[i+1]
	ans[i]=xor

print(*ans)

Solution (Python):
n=int(input())
a=[int(i) for i in input().split()]
x=0
for i in a:
    x^=i

b=[x^i for i in a]
for i in b:
    print(i,end=" ")

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
res = a[0]
for i in range(1, n):
    res ^= a[i]
for i in range(n):
    a[i] ^= res
print(*a)

Solution (Python):
n=int(input())
a=[int(i) for i in input().split()]
x=0
for i in a:
    x^=i
b=[x^i for i in a]
for i in b:
    print(i,end=" ")

Solution (Python):
import sys
import time
import math
st = time.perf_counter()
def inpl():
    return list(map(int, input().split()))


N = int(input())
ls = inpl()

a = 0
for i in ls:
    a = a ^ i

for i in ls:
    print(i ^ a, end=' ')
print()


ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]
s = 0
for ai in a:
    s ^= ai
b = [a[i] ^ s for i in range(n)]
print(*b)

Solution (Python):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    xored = 0
    for a in A:
        xored ^= a
    ans = [str(xored^a) for a in A]
    print(' '.join(ans))

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]
s = 0
for ai in a:
    s ^= ai
b = [0] * n
for i in range(n):
    b[i] = a[i] ^ s
print(*b)

Solution (Python):
from sys import stdin
n = int(stdin.buffer.readline())
a = list(map(int, stdin.buffer.readline().split()))
axor = 0
for i in a:
    axor ^= i
ans = [axor^x for x in a]
print(*ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
bit_num = 30
A_b = [format(a, '0{}b'.format(bit_num)) for a in A]
S = ''
for i in range(bit_num):
    bit = 0
    for a in A_b:
        if a[i] == '1':
            bit += 1
    if bit % 2 == 0:
        S += '0'
    else:
        S += '1'

B = []
for a in A_b:
    b = ''
    for i in range(bit_num):
        if (int(a[i]) + int(S[i])) % 2 == 0:
            b +='0'
        else:
            b += '1'
    
    B.append(int(b, 2))
print(*B)

Solution (Python):
def solve(A,N):
    xor_sum = 0
    for i in range(N):
        xor_sum ^= A[i]

    B = [xor_sum ^ A[i] for i in range(N)]

    return B

def main():
    N = int(input())
    A = list(map(int,input().split()))

    ans = solve(A,N)

    print(" ".join(map(str,ans)))

if __name__ == "__main__":
    main()

Solution (Python):
from functools import reduce
from operator import xor

n = int(input())
list_a = list(map(int, input().split()))

xorsum = reduce(xor, list_a)
list_n = [xor(xorsum, a) for a in list_a]

print(' '.join(map(str, list_n)))

Solution (Python):
from functools import reduce
N = int(input())
A = [int(i) for i in input().split()]
S = reduce(lambda a, b: a^b , A)
print(*[a ^ S for a in A])

Solution (Python):



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

xor_all = 0
for a in A:
    xor_all = xor_all ^ a

X=[]
for a in A:
    X.append(str(xor_all^a))

print(' '.join(X))

Solution (Python):
N= int(input())
nums = list(map(int, input().split()))

total = 0

for n in nums:
    total ^= n


orig = [total ^ n for n in nums]

print(' '.join(str(n) for n in orig))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

ma = max(a)
tmp = 1
m = 0
while True:
    if tmp >= ma:
        break
    tmp *= 2
    m += 1

memo = [0 for i in range(m+1)]

for j in range(m+1):
    cnt0 = 0
    cnt1 = 0
    for ai in a:
        if ai & (1 << j):
            cnt1 += 1
        else:
            cnt0 += 1
    if cnt1 % 2 == 0 and cnt0 % 2 == 0:
        memo[j] = 1

ans = []


for ai in a:
    ansi = 0
    for j in range(m+1):
        if ai & (1 << j):
            if memo[j]:
                ansi += 2 ** j
        else:
            if memo[j] == 0:
                ansi += 2 ** j

    ans.append(str(ansi))

print(" ".join(ans))

Solution (Python):

import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
all_xor =0
for i in a:
    all_xor ^=i
for i in a:
    print(all_xor ^i,end=" ")

Solution (Python):
def resolve():
    n = int(input())
    an = list(map(int, input().split()))
    from functools import reduce
    anxor = reduce(lambda lhs, rhs: lhs ^ rhs, an)

    print(*[anxor ^ a for a in an])

if __name__ == '__main__':
    resolve()

Solution (Python):
n = int(input())
lst = list(map(int, input().split()))
all = 0
for i in range(n):
    all ^= lst[i]
for i in range(n-1):
    print(all ^ lst[i], end=' ')
print(all ^ lst[n-1])

Solution (Python):
n = int(input())
arr = list(map(int,input().split()))
ans = arr[0]
for i in range(1,n):
    ans = ans^arr[i]

brr=[]
for i in range(n):
    brr.append(ans^arr[i])
print(*(brr),sep=" ")

Solution (Python):

from __future__ import print_function
import sys

if sys.subversion[0] == "PyPy":
    import io, atexit

    sys.stdout = io.BytesIO()
    atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

    sys.stdin = io.BytesIO(sys.stdin.read())
    input = lambda: sys.stdin.readline().rstrip()
RS = raw_input
RA = lambda x=int: map(x, RS().split())
RN = lambda x=int: x(RS())


def solve():
    s = 0
    for ai in a:
        s ^= ai
    ans = []
    for ai in a:
        ans.append(s ^ ai)
    print(*ans)
    return




n = RN()
a = RA()
solve()

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
all_xor = a[0]
for j in range(1, len(a)):
    all_xor = all_xor ^ a[j]
answer = [0] * N
for i in range(N):
    answer[i] = all_xor ^ a[i]
    
print(' '.join(map(str, answer)))

Solution (Python):
N=input()
A=list(map(int,input().split()))
all = 0
for i in range(len(A)):
	all^=A[i]
for i in range(len(A)):
	print(all^A[i],end=' ')

Solution (Python):
N=input()
A=list(map(int,input().split()))
all = 0
for i in range(len(A)):
	all^=A[i]
for i in range(len(A)):
	print(all^A[i],end=' ')

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
l = [0] * 30
b = []
for i in range(n):
  x = a[i]
  t = ''
  j = 29
  while j >= 0:
    if x < 2**j:
      t += '0'
    else:
      x -= 2**j
      t += '1'
      l[j] += 1
    j -= 1
  b.append(t)
ans = []
for i in range(n):
  t = b[i]
  d = 0
  for j in range(30):
    k = l[j]
    if t[-(j+1)] == '1':
      k += 1
    k %= 2
    d += k * 2**j
  ans.append(d)
print(*ans)

Solution (Python):

import sys
import numpy as np
input = sys.stdin.readline
n=int(input())
A =  list(map(int,input().split()))
B = []
ans = A[0]
for i in range(1,n):
    ans = ans ^ A[i]


for i in range(n):
    B.append(ans ^ A[i])
L=[str(a) for a in B]
L=" ".join(L)
print(L)

Solution (Python):
n = int(input())
a_li = [int(w) for w in input().split()]

S = a_li[0]
for a in a_li[1:]:
    S ^= a

for a in a_li:
    print(a ^ S, end=" ")

Solution (Python):

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

axor = A[0]
for i in range(1,N):
    axor ^= A[i]

for i in range(N):
    output.append(axor^A[i])
print(*output)

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]

s = 0
for v in a:
    s ^= v

b = [s^v for v in a]
print(*b)

Solution (Python):
n = int(input())
t = 0
a = list(map(int,input().split()))

for i in a:
    t^=i

for i in a:
    print(t^i,end=" ")

Solution (Python):
import sys
from functools import reduce
from operator import xor
readline = sys.stdin.buffer.readline

n = int(readline())
a = tuple(map(int, readline().split()))

s = reduce(xor, a[1:], a[0])

b = tuple(str(s ^ v) for v in a)
print(' '.join(b))

Solution (Python):
def main():
    N = int(input())
    a = list(map(int, input().split()))

    allxor = 0
    for i in a:
        allxor ^= i

    ans = [0] * N
    for i in range(N):
        ans[i] = allxor ^ a[i]

    print(*ans)


if __name__ == '__main__':
	main()

exit()

Solution (Python):
read = lambda: list(map(int, input().split()))
n = int(input())
a = read()
xo = 0
for i in a:
    xo ^= i
for i in a:
    print(xo ^ i, end=" ")
print()

Solution (Python):
n = int(input())
arr = list(map(int,input().split()))
xors = 0
for val in arr:
  xors^=val
ans = []
for i in range(n):
  ans.append(xors^arr[i])
  
print(*ans)

Solution (Python):
N=int(input())
a=map(int,input().split())
a=[int(b) for b in a]
answers=[]
answer=a[0]
for n in range(1,N):
    answer=answer^a[n]
for a_ in a:
    answers.append(answer^a_)
print(*answers)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

S = 0
for a in A:
    S = S ^ a
ans = [str(S^a) for a in A]
s = " ".join(ans)
print(s)

Solution (Python):
n = int(input())
cats = list(map(int, input().split()))
key = cats[0]
for c in cats[1:]:
    key ^= c

res = []
for c in cats:
    res.append(str(c ^ key))
print(' '.join(res))

Solution (Python):
n=int(input())
s=list(map(int,input().split()))
ans=s[0]
for i in range(1,n):ans^=s[i]
for i in range(n):print(ans^s[i],end=' ')

Solution (Python):
N = int(input())
ai = list(map(int, input().split()))

tmp = 0
for item in ai:
    tmp = tmp ^ item
for item in ai:
    print(item ^ tmp, end=" ")

Solution (Python):
from sys import stdin, stdout

int_in = lambda: int(stdin.readline())
arr_in = lambda: [int(x) for x in stdin.readline().split()]
mat_in = lambda rows: [arr_in() for _ in range(rows)]
str_in = lambda: stdin.readline().strip()
out = lambda o: stdout.write("{}\n".format(o))
arr_out = lambda o: out(" ".join(map(str, o)))
bool_out = lambda o: out("YES" if o else "NO")
tests = lambda: range(1, int_in() + 1)
case_out = lambda i, o: out("Case 



def solve(n, a):
    xor = a[0]
    for item in a[1:]:
        xor ^= item

    return map(lambda x: xor ^ x, a)


if __name__ == "__main__":
    n = int_in()
    a = arr_in()
    arr_out(solve(n, a))

Solution (Python):


N = int(input().strip())
A_list = list(map(int, input().rstrip().split()))


S_xor = 0
ans = []

for a in A_list:
    S_xor ^= a

for a in A_list:
    x = S_xor ^ a
    ans.append(x)

print(*ans)

Solution (Python):

from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

def main():
    N = int(input())
    a = list(map(int, input().split()))
    L = [0]*(N+1)
    R = [0]*(N+1)
    for i in range(N):
        L[i+1] = L[i]^a[i]
        R[N-i-1] = R[N-i]^a[N-i-1]
    ans = [None]*N
    for i in range(N):
        ans[i] = L[i]^R[i+1]
    print(*ans)
    


if __name__ == "__main__":
    main()

Solution (Python):

from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

def main():
    N = int(input())
    a = list(map(int, input().split()))
    L = [0]*(N+1)
    R = [0]*(N+1)
    for i in range(N):
        L[i+1] = L[i]^a[i]
        R[N-i-1] = R[N-i]^a[N-i-1]
    ans = [None]*N
    for i in range(N):
        ans[i] = L[i]^R[i+1]
    print(*ans)
    


if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
a=[int(i) for i in input().split()]
all_xor = 0
for i in a:
    all_xor ^= i
for i in a:
    print(i ^ all_xor , end=' ')

Solution (Python):


N = int(input())
A = list(int(a) for a in input().split())

B = A[0]
for i in range(1, N):
    B ^= A[i]

C = []
for i in range(N):
    C.append(B^A[i])

print(' '.join(map(str, C)))

Solution (Python):
N = int(input())
a = list(map(int, input().split()))

t = 0
for e in a:
    t ^= e

print(*[e ^ t for e in a])

Solution (Python):





N = int(input())
xor_num = [int(x) for x in input().split()]
total = 0

for n in xor_num:
  total = total ^ n
for i in range(N):
  print(xor_num[i] ^ total, end=' ')

Solution (Python):
import sys
readline = sys.stdin.readline

N = int(readline())
A = list(map(int,readline().split()))

from functools import reduce
xor = reduce(lambda x,y:x^y,A)

ans = [None] * N
for i in range(len(A)):
  ans[i] = xor ^ A[i]
  
print(*ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
xor_A = A[0]
for i in range(1, N, 1):
    xor_A = xor_A^A[i]
ans = [xor_A^a for a in A]
print(" ".join(map(str, ans)))

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
xor = 0
for a in A:
    xor ^= a
ans = [0]*N
for i in range(31):
    bit = 2**i
    if xor&bit:
        for j in range(N):
            if not A[j]&bit: ans[j] += bit
    else:
        for j in range(N):
            if A[j]&bit: ans[j] += bit
print(*ans)

Solution (Python):
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**6)

n=int(input().rstrip())
a=[int(i) for i in input().split()]
cumxor1=[0]
cumxor2=[0]
ans=[]
for i in a:cumxor1.append(cumxor1[-1]^i)
for i in reversed(a):cumxor2.append(cumxor2[-1]^i)
cumxor2=list(reversed(cumxor2))
for i in range(n):
    ans.append(cumxor1[i]^cumxor2[i+1])
print(*ans)

Solution (Python):



def main():
    import sys
    input = sys.stdin.readline

    n = int(input())
    a = list(map(int, input().split()))
    xor = 0

    for ai in a:
        xor ^= ai

    tmp = xor
    ans = list()

    for ai in a:
        xor ^= ai
        ans.append(xor)
        xor = tmp

    print(' '.join(map(str, ans)))


if __name__ == '__main__':
    main()

Solution (Python):



def main():
    import sys
    input = sys.stdin.readline

    n = int(input())
    a = list(map(int, input().split()))
    xor = 0

    for ai in a:
        xor ^= ai

    tmp = xor
    ans = list()

    for ai in a:
        xor ^= ai
        ans.append(xor)
        xor = tmp

    print(' '.join(map(str, ans)))


if __name__ == '__main__':
    main()

Solution (Python):
import sys,heapq
input = sys.stdin.buffer.readline

n = int(input())
a = list(map(int,input().split()))

p = 0
for e in a:
    p ^= e


res = [0]*n
for i in range(n):
    res[i] = a[i]^p

print(*res)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
S = 0
 
for i in a:
  S = S^i
  
ans = []
 
for i in a:
  ans.append(S^i)
  
print(*ans)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
S = 0

for i in a:
  S = S^i
  
ans = []

for i in a:
  ans.append(S^i)
  
print(*ans)

Solution (Python):
n=int(input())
ans=0
a=list(map(int,input().split()))
for i in range(n):
    ans^=a[i]
t=[]    
print(" ".join(str(ans^a[i]) for i in range(n)))

Solution (Python):

import sys


def solve(N: int, a: "List[int]"):
    xsum = 0
    for x in a:
        xsum = xsum ^ x
    print(" ".join(str(xsum ^ x) for x in a))
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    a = [int(next(tokens)) for _ in range(N)]  
    solve(N, a)

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
a = list(map(int, input().split(" ")))
val = a[0]
for e in a[1:]:
    val ^= e
for e in a:
    print(val ^ e, end=' ')
print('')

Solution (Python):
import sys


from collections import defaultdict, Counter
inp = sys.stdin.readline
read = lambda: list(map(int, inp().strip().split()))





def solve():
	n = int(input()); arr = read()
	cum = arr[0]
	for i in arr[1:]:cum ^= i
	for i in range(n):arr[i] = arr[i]^cum
	print(*arr)

		

if __name__ == "__main__":
	solve()

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
s = 0
for a_i in a:
  s ^= a_i
for a_i in a:
  print(s ^ a_i, end=' ')
print()

Solution (Python):
N=int(input())
A=[int(x) for x in input().split()]

t=0
for i in range(N):
  t^=A[i]

print(*[A[i]^t for i in range(N)])

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

s = a[0]
for num in a[1:]:
  s ^= num

res = [0] * n
for i, num in enumerate(a):
  res[i] = s ^ num

print(*res)

Solution (Python):
from functools import reduce
def resolver(N, A):
    X = reduce(int.__xor__, A)
    ans = [str(X^a) for a in A]
    
    return ans

def test():
    pass

def main():

    

    N = int(input())
    A = list(map(int, input().split()))
    ans = resolver(N, A)

    print(" ".join(ans))
    



if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
A = list(map(int,input().split()))

t = A[0]
for i in range(1,N):
    t = t ^ A[i]

l = []
for i in range(N):
    l.append(t^A[i])
print(" ".join(map(str,l)))

Solution (Python):
n = int(input())
A = list(map(int, input().split()))

xor = 0
for a in A:
    xor ^= a
result = []
for a in A:
    result.append(str(xor ^ a))
print(' '.join(result))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
ans = [0] * n
allsum = 0
for i in a:
    allsum = allsum ^ i
 
for i in range(n):
    ans[i] = allsum ^ a[i]
print(*ans)

Solution (Python):
n = int(input())
ai = [int(i) for i in input().split()]

ans = ai[0]

for i in range(n-1):
    ans = ans ^ ai[i+1]
    
ans_li = []

for i in range(n):
    ans_li.append(ans^ai[i])
    
print(*ans_li)

Solution (Python):
from collections import defaultdict
it = lambda: list(map(int, input().strip().split()))
INF = float('inf')

def solve():
    N = int(input())
    X = it()
    a = 0 
    for x in X:
        a = a ^ x
    
    ans = ''
    for x in X:
        ans += str(x ^ a) + ' '
    print(ans)

if __name__ == '__main__':
    solve()

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
A = 0
for ai in a:
    A^=ai
ans = [A^ai for ai in a]
print(*ans)

Solution (Python):
t=int(input())
n=list(map(int,input().split()))
xor=0
for x in n:
  xor^=x
for x in n:
  print(x^xor,end=" ")

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
x = 0
for i in range(0, N):
    x ^= a[i]
ans = []
for i in range(0, N):
    ans.append(str(x ^ a[i]))

print(' '.join(ans))

Solution (Python):
n = int(input())
arr = [int(i) for i in input().split()]

left = [0]*n
xor = arr[0]
for i in range(1, n):
  left[i] = xor
  xor ^= arr[i]

right = [0]*n
xor = arr[n-1]
for i in range(n-2, -1, -1):
  right[i] = xor
  xor ^= arr[i]

for i in range(n):
  arr[i] = left[i] ^ right[i]

print(*arr)

Solution (Python):
N = int(input())
scarfs = list(map(int, input().split()))
xor_sum = scarfs[0]
for i in range(1, N):
    xor_sum = xor_sum ^ scarfs[i]

for scarf in scarfs:
    print(xor_sum ^ scarf, end=' ')

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
xor = 0
for i in range(n):
    xor ^= a[i]
for i in range(n):
    print(xor ^ a[i],end = ' ')

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
xor = 0
for i in a:
    xor = xor^i
for i in a:
    print(xor^i,end=" ")
print()

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

summ = 0
for i in A:
    summ ^= i

ans = []
for i in A:
    ans.append(summ^i)

print(" ".join(map(str, ans)))

Solution (Python):
n=int(input())

a=list(map(int, input().split()))
t1=0;
for i in range(n):
	t1^=a[i]


for i in range(n):
	a[i]=t1^a[i]
print(*a, sep=" ")

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
aa = a[0]
for i in range(1,n):
    aa = aa ^ a[i]
for i in range(n):
    print(aa ^ a[i],end=' ')

Solution (Python):



def main():
    N = int(input())
    A = list(map(int, input().split()))
    x = 0
    for a in A:
        x ^= a
    ret = [None]*N
    for i,a in enumerate(A):
        ret[i] = x ^ a
    print(*ret)



if __name__ == '__main__':
    main()

Solution (Python):
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10**7)

ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

n = ni()
a = na()

x = 0
for i in range(n):
    x ^= a[i]

ans = []
for i in range(n):
    ans.append(x ^ a[i])

print(*ans)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
s=0
for i in a:
  s^=i
b=[]
for j in range(n):
  b.append(s^a[j])
print(*b)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

s = 0
for a_i in a:
    s ^= a_i

b = []
for a_i in a:
    b.append(str(s ^ a_i))

print(" ".join(b))

Solution (Python):
n=int(input())
A=list(map(int,input().split()))
Xall=0
for a in A:
	Xall^=a
L=[]
for a in A:
	L.append(a^Xall)
print(*L)

Solution (Python):
n=int(input())
A=list(map(int,input().split()))
a=A[0]
for i in range(n-1):
  a=a^A[i+1]
  
for i in range(n):
  print(a^A[i])

Solution (Python):
n=int(input())

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

sum_xor = t[0]

for i in range(1,n):
    sum_xor = sum_xor ^ t[i]

ans = []

for i in t:
    ans.append(sum_xor ^ i)

print(*ans)

Solution (Python):
n = int(input())
L = list(map(int,input().split()))
xor= 0
for i in range(n):
    xor ^=L[i]
li = []
for i in range(n):
    li.append(xor^L[i])
print(*li)

Solution (Python):
def solve(n, a):
    x = a[0]
    for i in range(1, n):
        x = x ^ a[i]
    ans = [x ^ a[i] for i in range(n)]
    return " ".join(map(str, ans))

n = int(input())
a = list(map(int, input().split()))
print(solve(n, a))

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
ans=0
for i in A:
    ans^=i
ANS=[i^ans for i in A]
print(*ANS)

Solution (Python):
N = int(raw_input())

A = map(int, raw_input().split())

v = 0
for a in A:
  v ^= a
  
B = [v^a for a in A]

print " ".join(map(str, B))

Solution (Python):
n=int(input())
a=[int(j)for j in input().split()]
x=0
for i in a:
    x^=i
print(*[x^i for i in a])

Solution (Python):
n=int(input())
a=[int(j)for j in input().split()]
x=0
for i in a:
    x^=i
print(*[x^i for i in a])

Solution (Python):
N = int(input())
A = list(map(int,input().split()))

def binary(a):
    x = a
    out = ''
    while a>0:
        out = str(a % 2) + out
        a = int(a / 2)
    return out

binaryA = [0]*N
for i in range(N-1):
    binaryA[i] = binary(A[i])

S = 0

for i in A:
    S = S ^ i

ans = []
for i in A:
    ans.append(str(S^i))

print(' '.join(ans))

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

X = A[0]

for i in range(1, N):
    X = X ^ A[i]

for i in range(0, N):
    print(X ^ A[i], end=' ')

print('')

Solution (Python):
n = int(input())
a = list(map(int , input().split()))
b = []
s = 0
for ai in a:
    s ^= ai
ans = []
for ai in a:
    ans.append(s ^ ai)

print(' '.join(map(str, ans)))

Solution (Python):

N = int(input())

A = [int(x) for x in input().split(" ")]

x = 0
for a in A:
    x= x ^ a

for a in A:
    y = x ^ a
    print(y, end = " ")
print()

Solution (Python):
n,*a=map(int,open(0).read().split())
xor=0
for x in a:
	xor^=x
ans=[]
for y in a:
	ans+=y^xor,
print(*ans)

Solution (Python):
import sys
sys.setrecursionlimit(10**9)

def main():
    n = int(input())
    a = list(map(int, input().split()))
    
    total = 0
    for i_a in a:
        total ^= i_a

    ans = []
    for i_a in a:
        now_ans = 0
        for i_bin in range(49):
            if i_a & (1 << i_bin) == 0:
                if total & (1 << i_bin) != 0:
                    now_ans += (1 << i_bin)
            else:
                if total & (1 << i_bin) == 0:
                    now_ans += (1 << i_bin)

        ans.append(str(now_ans))

    print(' '.join(ans))
    return


if __name__ == "__main__":
    main()
    sys.exit(0)

Solution (Python):
N = int(input())

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

x = 0
for a in A:
  x ^= a

ans = []
for a in A:
  ans.append(x^a)
print(*ans)

Solution (Python):
def main():
    n = input()
    a = [int(v) for v in input().split()]
    xorsum = 0
    for v in a:
        xorsum ^= v
    for v in a:
        print(xorsum ^ v)


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
As = list(map(int, input().split()))
s = 0
for A in As:
  s = s^A
rs = [s^A for A in As]
print(" ".join(map(str, rs)))

Solution (Python):
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N,*A = map(int, read().split())
    
    X = 0
    for a in A:
        X ^= a

    ans = []
    for a in A:
        ans.append(a ^ X)

    print(*ans)


if __name__ == "__main__":
    main()

Solution (Python):
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))

n  =readint()
a = readints()

b = 0
for i in range(n):
    b^=a[i]
ans = [b^a[i] for i in range(n)]

printline(ans)