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()))
ans=0
for i in range(N):
    ans=ans^A[i]
B=[0 for i in range(N)]
for i in range(N):
    B[i]=ans^A[i]
print(*B)

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

ans = 0
for i in range(n):
    ans = ans^a[i]
    
for i in range(n):
    print(ans^a[i], end=' ')

Solution (Python):
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd 
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) 

n = int(input())
lin = [0 for i in range(n+1)]
ans = [0 for i in range(n)]
a = list(map(int, input().split()))
for i in range(n):
    lin[i + 1] = lin[i]^a[i]

ans[n - 1] = lin[n - 1]
sumv = 0
for i in range(n-1, 0, -1):
    sumv ^= a[i]
    ans[i - 1] = lin[i - 1]^sumv
    
for x in ans:
    print(x, '', end='')
print()

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

all = 0
for a in a_list:
    all = all ^ a

for a in a_list:
    print(a ^ all, end=" ")
print()

Solution (Python):
import numpy as np




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


def solve(N,A):
    l = []
    S = np.bitwise_xor.reduce(A)
    S = S ^ A[0]
    l += (str(S),)
    i = 1
    while i < len(A):
        S = S ^ A[i-1] ^ A[i]
        l += (str(S),)
        i+= 1
    print(" ".join(l))
        
solve(N,A)

Solution (Python):


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

    ans = []
    for a in al:
        curr_ans = all_xor ^ a
        ans.append(curr_ans)

    print(*ans)


if __name__ == "__main__":
    main()

Solution (Python):
import sys

if __name__ == '__main__':
    n = int(sys.stdin.readline())
    A = list(map(lambda x: int(x), sys.stdin.readline().split()))
    allxor = 0
    for a in A:
        allxor ^= a
    for a in A:
        print(allxor^a, end=' ')
    print()

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
a=list(map(bin, a))
b=list(map(len, a))
M=max(b)-2
for i in range(N):
    a[i] = '0'*(M-len(a[i])+2)+a[i][2:]
cnt = [0]*M

for i in range(N):
    for j in range(M):
        if a[i][j] == '1':
            cnt[j]+=1
for i in range(M):
    cnt[i]%=2
for i in range(N):
    ans=''
    for j in range(M):
        if int(a[i][j])!=cnt[j]:
            ans=ans+'1'
        else:
            ans=ans+'0'
    print(int(ans, 2), end=' ')

Solution (Python):
from sys import stdin

def main():

    input = stdin.readline

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

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

    ans_list = []
    for i in A:
        ans_list.append(a ^ i)

    print(*ans_list)


if __name__ == "__main__":
    main()

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

ls=[]
for i in range(N):
  ls.append(p^a[i])
print(' '.join(map(str, ls)))

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

allbit = A[0]
for n in range(1,N):
  allbit = allbit ^ A[n]

ans = ["" for _ in range(N)]
for n in range(N):
  ans[n]= allbit ^ A[n]
  
print(*ans)

Solution (Python):
import sys
import numpy as np

readline = sys.stdin.readline

n = int(input())
a = np.array(readline().split(), dtype= np.int64)
x = np.bitwise_xor.reduce(a)
a ^= x
print(*a)

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):
N = int(input())
a = list(map(int,input().split()))

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

for i in range(N):
    temp = ret ^ a[i]
    ans.append(temp)
    
print(*ans)

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

def xor(x):
    r = 0
    for i in x:
        r ^= i
    return r

if __name__ == '__main__':
    main()

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

Solution (Python):
N = int(input())
A = [int(i) for i in input().split()]
L = 0
for a in A:
    L  ^=a
for a in A:
    print(L^a,end=" ")

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

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


L=[]
for i in A:
    L.append(X^i)
print(*L)

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

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
total = 0
for i in a:
    total ^= i

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

print(*ans)

Solution (Python):
N, *A = map(int, open(0).read().split())

target = 0
for i in range(N):
    target ^= A[i]
    
ans = [0] * N
for i in range(N):
    ans[i] = A[i] ^ target
    
print(*ans)

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

result = []
res = A[1]
for a in A[2:N]:
    res ^= a
result.append(str(res))

for i in range(0, N-1):
    res = A[i] ^ A[i+1] ^ res
    result.append(str(res))

print(" ".join(result))

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
total = 0
for i in a:
    total ^= i

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

print(*ans)

Solution (Python):
from functools import reduce
n=int(input())
l=[int(x) for x in input().split(" ")]
e= reduce(lambda x, y: x ^ y, l)
for x in l:
    print(x^e,end=" ")

Solution (Python):
N = int(input())
a = [int(x) for x in input().split()]
cnt = 0
for i in a:
  cnt ^= i
s = []
for i in a:
  b = str(cnt^i)
  s.append(b)
print(" ".join(s))

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
mx=len(bin(max(a)))
b=["0"*(mx-len(bin(x)))+bin(x)[2:] for x in a]

out=["" for _ in range(n)]
for i in range(mx-2):
    tot=0
    for j in range(n):
        tot+=int(b[j][i])
    tot=tot%2
    for j in range(n):
        if tot==int(b[j][i]):out[j]+="0"
        else : out[j]+="1"
c=[str(int(y,2)) for y in out]
print(" ".join(c))

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

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

ans = [0] * N

for i, a in enumerate(A):
    ans[i] = total ^ a

print(*ans)

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

Solution (Python):

def main():
    import sys
    imput = sys.stdin.readline
    
    
    
    N = int(input())
    a = list(map(int, input().split()))

    
    x = a[0]
    for i in range(1, N):
        x = x^a[i]

    c = [x^aa for aa in a]
    for s in c:
        print(int(float(s)), end = " ")

    
if __name__ == "__main__":
    main()

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

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

Solution (Python):

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


x = a[0]
for i in range(1, N):
    x = x^a[i]

c = [x^aa for aa in a]
for s in c:
    print(int(float(s)), end = " ")

Solution (Python):
def constructXOR(A, n): 
    XOR = 0
    for i in range(0, n): 
        XOR ^= A[i] 
    for i in range(0, n): 
        A[i] = XOR ^ A[i] 
  
n=int(input())
A=list(map(int,input().strip().split()))
constructXOR(A, n) 
for i in range(0,n): 
    print(A[i], end =" ")

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


allXor = 0


def output_b(v):
    return format(v, '08b') +":" + format(v)

for a in values:
    allXor = allXor ^ a

for a in values:
    result = allXor ^ a
    print(result)

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

a_xor = ali[0]
for i in ali[1:]:
    a_xor = a_xor^i

ans = []
for i in ali:
    ans.append(a_xor^i)

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

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

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
s = len(bin(max(a)))-2

box = [0] * s
bbbox = [] * n
for i in range(n):
    bbbox.append(format(a[i],'b').zfill(s))
    for j in range(s):
        box[j] += int(bbbox[-1][-j-1])


ans = [0] * n
for i in range(s):
    for j in range(n):
        if box[i] % 2 == 0:
            if bbbox[j][-1-i] == '1':
                ans[j] += 2 ** i
        else:
            if bbbox[j][-1-i] == '0':
                ans[j] += 2 ** i
print(*ans)

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

Solution (Python):
n = int(input())
A = list(map(int, input().split()))
res = 0
for a in A:
    res ^= a

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

print(*ans)

Solution (Python):
N = int(input())
A = [int(a) for a in input().split()]
p = 0
for a in A[1:]:
    p ^= a
ans = [p]
l = A[0]
for i in range(1, N):
    k = l
    l = A[i]
    h = k ^ l
    ans.append(ans[i-1] ^ h)

for a in ans:
    print(a, end=' ')
print()

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




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



for a in A:
    mem = bin(xorAll)
    ans = xorAll^a
    print(ans, end=' ')

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

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

s = []

if n % 2 == 0:
    x = a[0]
    for i in range(1, n):
        x = x ^ a[i]

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

else:
    x = a[0]
    for i in range(1, n-1):
        x = x ^ a[i]

    for i in range(n-1):
        s.append(x ^ a[i])

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

    s.append(y ^ a[n-1])

t = list(map(str, s))

print(" ".join(t))

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    A = list(map(int, input().split()))
    x = A[0]
    for a in A[1:]:
        x ^= a
    ans = []
    for a in A:
        ans.append(str(x^a))
    print(" ".join(ans))

if __name__ == '__main__':
    main()

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

Solution (Python):
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
LS=lambda:list(map(str,input().split()))

n=I()
a=L()
xorall=a[0]
for i in range(1,n):
    xorall=xorall^a[i]
for i in a:
    print(xorall^i,end=" ")
print()

Solution (Python):
from functools import reduce

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

res = reduce(lambda x, y: x ^ y, a)
ans = [res ^ i for i in a]
print(*ans)

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

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

for a in A:
    print(a ^ total)

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

for j in range(n):
    ans.append(str(total^list[j]))
print(" ".join(ans))

Solution (Python):
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]

N = ri()
a = ri_()
s = 100000000000000
for i in range(N):
    if s == 100000000000000:
        s = a[i]
    else:
        s = s ^ a[i]
ans = [0] * N
for i in range(N):
    print(s ^ a[i], end = ' ' if i < N - 1 else '\n')

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

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

for y in a:
    print(y ^ xor_sum)

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

goukei = 0

for i in a:
    goukei ^= i

ans = [goukei^i for i in a]
print(*ans)

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

sum = 0

for i in a:
    sum = sum^i



l = []

for j in a:
    l.append(sum^j)

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

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
temp = a[0]
for n in range(1, N):
    temp = temp ^ a[n]
rui = temp
for el in a:
    print(rui ^ el, end=" ")

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
"""
全員が自分以外の全員のxorを把握しているので、全員の値を求めよ
nは偶数

桁ごとに独立に考える。
テストケースで検証すると、
その桁において1の数が偶数個の場合は、自分自身の桁の数字を入れる
奇数個の場合は、自分自身の桁の値をbit反転したものを入れる
ことが正解であることが分かる。
これを実装するだけ。
"""
n = int(readline())
lst1 = list(map(int,readline().split()))
limit = 33 
ans = []
parity = [0]*limit
for i in lst1:
    for j in range(limit):
        parity[j] += i>>j

for i in range(limit):
    parity[i] %= 2

for i in lst1:
    res = 0
    for j in range(limit):
        p = i>>j&1
        if parity[j]== 0 and p== 1:
            res += 1<<j
        elif parity[j] == 1 and p == 0:
            res += 1<<j
    ans.append(res)
print(*ans)

Solution (Python):
import sys, collections, bisect, itertools, heapq, math, copy
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    a = LI()

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

    print(*[sum ^ i for i in a])

if __name__ == '__main__':
    resolve()

Solution (Python):
def main():
    N = int(input())
    a = list(map(int,input().split()))
    ANS = ""
    xor_all = 0
    for i in range(N):
        xor_all = xor_all^a[i]
    for i in range(N):
        if ANS != "":
            ANS += " "
        ANS += str(xor_all^a[i])
    print(ANS)
if __name__ == '__main__':
    main()

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

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

answer = []
for a in A:
  answer.append(all_xor ^ a)
  
print(" ".join(map(str, answer)))

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

Solution (Python):
import sys

sys.setrecursionlimit(10**6)
input = sys.stdin.readline


def main():
    N = int(input())
    A = list(map(int, input().split()))
    base = 0
    for a in A:
        base ^= a
    ans = []
    for i in range(N):
        ans.append(base^A[i])

    print(*ans)


if __name__ == "__main__":
    main()

Solution (Python):
def main():
  N = int(input())
  a = list(map(int, input().split()))
  ans = 0
  for i in a:
    ans = ans^i
  for i in a:
    print(ans^i)
    
if __name__ == "__main__":
  main()

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

ans = 0

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

for i in range (N):
    print(ans ^ a[i])

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

Solution (Python):

import sys


def solve(N: int, a: "List[int]"):
    allXor = a[0]^a[1]
    for i in range(2,N):
        allXor ^= a[i]
    s = ""
    for i in range(len(a)):
        isLast = (len(a) -1 ==i)
        c = str(allXor^a[i])
        if not isLast:
            s += c + " "
        else:
            s+=c
    print(s)
    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()))

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

Solution (Python):


def main():
    N = int(input())
    a = list(map(int, input().split()))
    xor = 0
    for i in range(0, len(a)):
        xor = xor ^ a[i]
    for i in range(0, len(a)):
        if i != 0:
            print(' ', end='')
        print(xor ^ a[i], end='')


if __name__ == '__main__':
    main()

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

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

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

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

Solution (Python):
from functools import reduce
n=int(input())
k=list(map(int,input().split()))
c=reduce(lambda a,b:a^b,k)
for i in range(n):
  print(k[i]^c,end=" ")

Solution (Python):

"""
Created on Sun Jun 21 22:04:00 2020

@author: NEC-PCuser
"""

N = int(input())

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

sum_a = 0

for i in a:
    sum_a ^= i

ans_list = []
for i in a:
    ans_list.append(str(sum_a ^ i))

print(' '.join(ans_list))

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

Solution (Python):
n=int(input())
x=[int(x) for x in input().split()]
s=x[0]
for i in range(1,len(x)):
	s=s^x[i]
z=[]
for i in range(len(x)):
	z.append(s^x[i])
print(*z)

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

x = 0
for l in lst:
    x ^= l
out = ''
for l in lst:
    out += ' ' + str(x^l)
print(out[1:])

Solution (Python):
n=int(input())
A=list(map(int,input().split()))
ans=[0]*n

tmp=A[0]

for i in range(1,n):
    tmp=tmp^A[i]

for i in range(n):
    ans[i]=A[i]^tmp
    
print(*ans)

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

input()
a = tuple(map(int, input().split()))
s = reduce(xor, a)
print(*(s ^ x for x in a))

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

if N==2:
  print(a[1], a[0])
  exit()
  
ans=[0]*N
tmp=a[1]^a[2]
for i in range(3, N):
  tmp=tmp^a[i]
  
ans[0]=tmp
for i in range(1, N):
  tmp=a[i-1]^a[i]
  ans[i]=tmp^ans[i-1]
  
print(*ans, sep=' ')

Solution (Python):
from functools import reduce

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

sum_xor = reduce(lambda a, b: a ^ b, nums)
print(*[sum_xor ^ x for x in nums])

Solution (Python):
from sys import stdin
from sys import setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)

INF = int(1e10)
MOD = int(1e9 + 7)

def main():
    from builtins import int, map
    N = int(input())
    A = list(map(int, input().split()))
    allxor = 0
    ans = [0] * N
    for k in range(N):
        allxor ^= A[k]
    for i in range(N):
        ans[i] = allxor ^ A[i]
    print(*ans)

if __name__ == '__main__':
    main()

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

if n == 2:
    print(*arr[::-1])
else:
    res = [0 for i in range(n)]
    temp = 0
    for i in range(1,n):
        temp ^= arr[i]^arr[i-1]
        res[i] = temp   
    
    allxor = 0
    for e in res:
        allxor ^= e
    first = allxor^arr[0]
    ans = []
    for e in res:
        ans.append(e^first)
    print(*ans)

Solution (Python):
from functools import reduce

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

all = reduce(lambda x, y: x ^ y, a)
ans = [all ^ i for i in a]
print(*ans)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
cumsum = [0]
for a in A:
  cumsum.append(cumsum[-1]^a)

res = []
for i in range(N):
  res.append(cumsum[-1]^A[i])

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

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

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

for a in A:
    print(L ^ a)

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 a:
  print(x^i)

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

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
cumsum = [0]
for a in A:
  cumsum.append(cumsum[-1]^a)

res = []
for i in range(N):
  res.append(cumsum[-1]^A[i])

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

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

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

for i in range(n):
  if n%2:
    use=A[i]
  else:
    use=A[i]^ans
  print(use)

Solution (Python):
import sys
N=int(sys.stdin.readline().strip())
A=map(int, sys.stdin.readline().split())

for i,a in enumerate(A):
    if i==0:
        total=a
    else:
        total^=a

for a in A:
    print a^total,

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

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

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

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

Solution (Python):
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline



def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    n = gete(int)
    a = list(geta(int))

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

    print(*[s ^ ai for ai in a], sep=" ")


if __name__ == "__main__":
    main()

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

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

a_xor_sum=0
for ai in a:
    a_xor_sum = a_xor_sum ^ ai

ans=[]
for ai in a:
    ans.append(a_xor_sum ^ ai)

print(*ans)

Solution (Python):
not_dict = {"0": "1", "1": "0"}
n = int(input())
a_list_0d = list(map(int, input().split()))
bit_sum = [0]
a_list_0b = list(map(lambda x: bin(x)[2:], a_list_0d))
max_bit = max(map(len, a_list_0b))
a_list_str = list(map(lambda x: x.zfill(max_bit), a_list_0b))
all_sum = 0
for i in range(n):
    all_sum ^= a_list_0d[i]
all_sum_str = bin(all_sum)[2:].zfill(max_bit)

new_list = ["0b" for _ in range(n)]
for b in range(max_bit):
    if all_sum_str[b] == '1':
        for i in range(n):
            new_list[i] += not_dict[a_list_str[i][b]]
    else:
        for i in range(n):
            new_list[i] += a_list_str[i][b]
    


for i in range(n):
    print(int(new_list[i], 0), end=" ")

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

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

ans = [] 
for a in A:
  ans.append(all_xor^a)
  
ans = [str(a) for a in ans]
ans = " ".join(ans)
print(ans)

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

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

results = []

for a in A:
    results.append(str(all_xor ^ a))

print(' '.join(results))

Solution (Python):
import sys
from operator import ixor
from functools import reduce


def main():
    input = sys.stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    s = reduce(ixor, a)
    res = [s ^ a[i] for i in range(n)]
    print(*res)


if __name__ == '__main__':
    main()

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


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

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

print(*ans,sep=" ")

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

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

res = []
for a in al:
    res.append(x^a)

print(*res)

Solution (Python):
import numpy as np

n = int(input())
a = np.array([int(i) for i in input().split()])

ans = np.zeros_like(a)
for i in range(len(f'{np.max(a):b}')):
    p = (a >> i & 1)
    cnt = np.count_nonzero(p)
    ans += ((cnt - p) % 2) * 2**i

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

Solution (Python):



def input_int():
    return int(input())



def int1(x):
    return int(x) - 1



def input_to_int_map():
    return map(int, input().split())



def input_to_int_tuple():
    return tuple(map(int, input().split()))



def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    n = int(input())
    a_list = input_to_int_tuple()

    all = 0
    for v in a_list:
        all ^= v

    ret = ""
    for v in a_list:
        ret += str(all ^ v) + " "

    print(ret.rstrip())


if __name__ == "__main__":
    main()

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

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

left = [0]
for i in range(1,n):
  left.append(left[-1]^arr[i-1])
arr = arr[::-1]
right = [0]
for i in range(1,n):
  right.append(right[-1]^arr[i-1])
right = right[::-1]
arr  = arr[::-1]

ans = []
for i in range(n):
  ans.append(left[i]^right[i])

for num in ans:
  print(num,end=" ")

Solution (Python):
from math import log
n=int(input())
arr=list(map(int,input().split()))
c=0
for i in arr:
    c=c^i
for i in arr:
    print(c^i,end=" ")

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

s = 0
for ai in a:
    s ^= ai
print(' '.join(map(lambda x: str(s ^ x), a)))

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

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

results = []
for a in A:
    results.append(str(xor ^ a))

print(' '.join(results))

Solution (Python):
import os
import sys
from io import BytesIO, IOBase


BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")



from math import factorial
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def RL(): return map(int, sys.stdin.readline().rstrip().split())
def RLL(): return list(map(int, sys.stdin.readline().rstrip().split()))
def N(): return int(input())
def comb(n, m): return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0
def perm(n, m): return factorial(n) // (factorial(n - m)) if n >= m else 0
def mdis(x1, y1, x2, y2): return abs(x1 - x2) + abs(y1 - y2)
mod = 998244353
INF = float('inf')





def main():
    n = N()
    arr = RLL()

    sm = 0
    for i in arr:
        sm^=i
    res = []

    for i in arr:
        res.append(i^sm)

    print(*res)


if __name__ == "__main__":
    main()

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

Solution (Python):
from math import log
n=int(input())
arr=list(map(int,input().split()))
c=0
for i in arr:
    c=c^i
for i in arr:
    print(c^i,end=" ")

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

Solution (Python):
import sys

input = sys.stdin.readline


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

    init = 0
    for a in A:
        init ^=a
    for a in A:
        print(init^a,end=" ")

if __name__ == "__main__":
    main()