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()))

all_xor = a[0]

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

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

Solution (Python):








def solve(N, As):
    all_xor = 0
    for A in As:
        all_xor ^= A
    ans = ''
    for A in As:
        ans += str(A ^ all_xor) + ' '
    print(ans[:-1])


if __name__ == '__main__':
    
    N = int(input())
    
    As = [int(i) for i in input().split()]
    
    solve(N, As)

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

N = int(input())
A = array.array("L", map(int, input().split()))

Q = array.array("L", [0]) * N

R = reduce(xor, A)
for i in range(N):
    print(R^A[i])

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

Solution (Python):
n = int( input() )
a = list( map(int, input().split()) )
x = 0
for i in a:
    x ^= i
print( * list( map( lambda y: x^y , a ) ) )

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

def main():
    n = int( input() )
    input_a = list ( map( int, input().split() ) )
    a = deque( input_a )

    while( len(a) != 1 ):
        x = a.popleft()
        y = a.popleft()
        z = x ^ y
        a.append(z)
    sum = a.popleft()
    ans = []
    for i in input_a:
        x = i ^ sum
        ans.append(x)

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



main()

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

s = 0
for i in range(n):
	s = s ^ a[i]
	
for i in range(n):
	x = s ^ a[i]
	print(x, end='')
	if i == n - 1:
		print('')
	else:
		print(' ', end='')

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

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

ans = [0] * n
for i , j in enumerate(lis):
    ans[i] = t ^ j

print(*ans)

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

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

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

ans = []
for i in a:
  ans.append(s ^ i)

print(*ans)

Solution (Python):
n = int(input())
arr = list(map(int, input().split()))
x = 0
for i in arr:
	x ^= i
print(*(list(map(lambda y: x ^ y, arr))))

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

for i in a:
  x=s^i
  ans+=str(x)
  ans+=' '

print(ans[:-1])

Solution (Python):
def main():
    N = int(input())
    A = [int(a) for a in input().split()]
    xor_all = A[0]
    
    for i in range(1, N):
        xor_all ^= A[i]

    for i in range(N):
        if i != N - 1:
            print(A[i]^xor_all, end=" ")
        else:
            print(A[i]^xor_all)

if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
A=list(map(int,input().split()))
aa=0
for i in A:
	aa^=i
ans=[0]*n
for i in range(n):
	ans[i]=aa^A[i]
print(' '.join(map(str,ans)))

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

Solution (Python):

import sys
from itertools import chain






def solve(N: int, A: "List[int]"):
    total = 0
    for a in A:
        total ^= a
    return [total ^ a for a in A]


def main():
    tokens = chain(*(line.split() for line in sys.stdin))
    
    N = int(next(tokens))  
    A = [int(next(tokens)) for _ in range(N)]  
    ans = solve(N, A)
    print(" ".join([str(a) for a in 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 = all_xor ^ _a
for _a in a:
    print(all_xor ^ _a)

Solution (Python):

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

for i in range(n):
  print(k^a[i],end=" ")

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

    scarf_0 = 0
    for a in A[1:]:
        scarf_0 ^= a
    
    scarf_all = scarf_0 ^ A[0]
    
    ans = [scarf_all^a for a in A]
    
    print(*ans, sep=" ")

if __name__ == "__main__":
    main()

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



N, *A = map(int, open(0).read().split())
B = reduce(xor, A)
print(*map(lambda a: B^a, A))

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

N, *A = map(int, open(0).read().split())
B = reduce(xor, A)
print(*map(lambda a: B^a, A))

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

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

bit=[0 for _ in range(30)]
b=[]

for x in a:
  y=[0 for _ in range(30)]
  for i in range(30):
    if (x>>i)&1:
      y[i]+=1
      bit[i]+=1
  b.append(y)
     
ans1=[]
for g in b:
  ans=0
  for j in range(30):
    if (bit[j]%2)!=(g[j]):
      ans+=2**j
  ans1.append(str(ans))
  
print(' '.join(ans1))

Solution (Python):
N = int(input())
a = [int(s) for s in input().split()]
b = a[0]
c = []
for i in range(1,N):
  b = b ^ a[i]

for i in range(N):
  c.append(str(b ^ a[i]))
 
d = ' '.join(c)

print(d)

Solution (Python):
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  

N = I()
a = LI()

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

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

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

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

for a in A:
  	print(ans^a)

Solution (Python):
import sys

input = sys.stdin.readline

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

all = 0
for a_i in A:
    all ^= a_i

ans = []
for a_i in A:
    ans.append(all ^ a_i)

print(*ans)

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

xor_base = A[0]
for a in A[1:]:
    xor_base ^= a

result = []
for a in A:
    result.append(a ^ xor_base)

print(*result)

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

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

ans=[]
for j in range(n):
    tmp = s^a[j]
    ans.append(tmp)

print(*ans)

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

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

t = 0
for c in A:
    t ^= c

ans = []
for b in A:
    ans.append(t^b)

print(*ans)

Solution (Python):
def main():
   n = int(input())
   a = list(map(int,input().split()))
   b = [0 for i in range(n)]
   c = 0
   for i in range(n):
       c ^= a[i]
   for i in range(n):
       b[i] = c ^ a[i]
   for i in range(n):
       if i == n - 1:
           print(b[i])
       else:
           print(b[i], end = ' ')
main()

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())

ALL = 0
for a in As:
    ALL ^= a
ans = [ALL^a for a in As]
print(*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(N):
    print(x^A[i], end=" ")

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

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

ans = A[0]

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

memo = []

for i in range(N):
    memo.append(ans ^ A[i])

print(*memo)

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

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


ans = []
for a in al:
    v = asum^a
    ans.append(v)

print(*ans)

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

a = 0

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

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

print(*ans)

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

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = inpl()
now = a[0]
for i in range(1,n):
    now ^= a[i]
for i in range(n):
    print(now ^ a[i])

Solution (Python):
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  
def LS2(): return list(sys.stdin.readline().rstrip())  

N = I()
a = LI()

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

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

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

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

ans = [0]*n
for j in range(n):
  ans[j] = s ^ a[j]

print(*ans)

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

P = 0

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

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

ans = [A[i] ^ P for i in range(N)]

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

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
sum_xor = A[0]

for i in range(1,N):
  sum_xor ^= A[i]
  
for j in range(N):
  print(sum_xor ^ A[j], end=" ")

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

M = [0] * N
S = 0
for i in range(N):
    S = S^A[i]

for i in range(N):
    M[i] = S^A[i]

print(*M)

Solution (Python):
from functools import reduce
N = int(input())
A = list(map(int, input().split()))
m = reduce(lambda a, b: a^b, A)
l = list(map(str, [a ^ m for a in A]))
ans = ' '.join(l)
print(ans)

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

print(*ans)

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

input = sys.stdin.readline

N = int(input())
a = list(map(int, input().split()))
s = reduce(xor, a)
print(' '.join([str(xor(s, i)) for i in a]))

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

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

    s = 0
    for i in a:
        s ^= i
    
    for i in a:
        ans = s ^ i
        print(ans, sep=' ', end=' ')

main()

Solution (Python):


def solve():
    """
    スカーフをそれぞれs[1]...s[N]とする
    Nは偶数より、
    必ず a[1]^...^a[N] = s[1]^...^s[N] (=Sと置く) になる。

    よって、s[1]が求めたかったら、s[1] = S ^ a[1]で求められる。
    """
    import sys
    N = int(sys.stdin.readline())
    As = list(map(int, sys.stdin.readline().split()))

    S = 0
    for a in As:
        S ^= a

    
    anss = []
    for i in range(N):
        anss.append(str(S^As[i]))

    ans = " ".join(anss)
    print(ans)


if __name__ == "__main__":
    solve()

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

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

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

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

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

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

pop=0 
while(xor >> pop >=1):
    pop += 1

sum_xor=xor 

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

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

Solution (Python):
from functools import reduce
n=int(input())
A=list(map(int, input().split()))
sumxor=reduce(lambda x,y:x^y,A)
for AA in A:
  print(sumxor ^ AA)

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

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

ans = []
for i in a:
    ans.append(b ^ i)
print(" ".join(map(str, ans)))

Solution (Python):
N = int(input())
a_list = list(map(int, input().split()))
all_xor = 0
res = []

for a in a_list:
    all_xor ^= a

for a in a_list:
    res.append(a ^ all_xor)

print(*res)

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

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

Solution (Python):
def main():
    N = int(input())
    a = list(map(int, input().split()))
 
    total = 0
    for other in a:
        total ^= other
 
    print(*[(other ^ total) for other in a])
 
 
if __name__ == "__main__":
    main()

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

for j in A:
    print(B ^ j)

Solution (Python):
n=int(input())
r=list(map(int,input().split()))
s=0
for u in r: s^=u
t=[x ^ s for x in r]
print(*t)

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

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

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

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
B = [0 for _ in range(N//2)]
for i in range(0,N,2):
    B[i//2] = A[i]^A[i+1]
tot = 0
for i in range(N//2):
    tot = tot^B[i]
X = [0 for _ in range(N)]
for i in range(N//2):
    y = tot^B[i]
    X[2*i]=A[2*i+1]^y
    X[2*i+1]=A[2*i]^y
print(*X)

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

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

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

Solution (Python):
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    n, *a = map(int, read().split())
    allxor = a[0]
    for ae in a[1:]:
        allxor = allxor ^ ae
    for ae in a:
        print(allxor ^ ae, end = ' ')

if __name__ == '__main__':
    main()

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

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

l = [all_fav_num_xor ^ a for a in A]

print(*l)

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

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

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

ans = []
for i in A:
    tmp = s
    tmp ^= i
    ans.append(tmp)
print(*ans)

Solution (Python):




















N = int(input())
a = [int(i) for i in input().split()]
p = 0b0
for i in range(N):
    p = p ^ a[i]
for i in range(N):
    print(p^a[i])

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

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

for i in range(N):
    print(now^A[i], end=" ")

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

Solution (Python):
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    total = 0
    for a in A:
        total ^= a
    ans = []
    for a in A:
        ans.append(total^a)
    return ans
print(*solve())

Solution (Python):
def abc171_e():
    n = int(input())
    A = list(map(int, input().split()))
    cum = 0
    for a in A:
        cum ^= a
    B = [0] * n
    for i, a in enumerate(A):
        B[i] = cum ^ a
    print(*B, sep=' ')

if __name__ == '__main__':
    abc171_e()

Solution (Python):
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
a = LIST()
b = 0
for x in a:
    b ^= x
ans = []
for x in a:
    ans.append(b^x)
print(*ans)

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

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

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

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

for i in range(N):
    print(a^A[i], end=" ")

Solution (Python):



from functools import reduce

def main():
  n = int(input())
  la = list(map(int, input().strip().split()))
  x = reduce(lambda x, y: x ^ y, la)
  print(' '.join([str(x ^ a) for a in la]))

if __name__=='__main__':
  main()

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

sumxor = 0
for a in aaa:
    sumxor = sumxor^a
bbb = [a^sumxor for a in aaa]
print(" ".join([str(b) for b in bbb]))

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

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

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

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

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

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

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

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

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

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

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

b = [0]*N

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

b[0] = xorsum ^ a[0]

for i in range(1,N):
    b[i] = b[i-1] ^ a[i-1] ^ a[i]

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

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

all_xor=a[0]
for i in range(1,N):
    all_xor=all_xor^a[i]
    
ans=[all_xor^a[i] for i in range(N)]
print(' '.join(list(map(str,ans))))

Solution (Python):
N=int(input())
L=list(map(int,input().split()))
s=0
R=list()
for i in range(N):
  s=s^L[i]
for i in range(N):
  R.append(str(s^L[i]))
print(" ".join(R))

Solution (Python):


import itertools
import collections
from decimal import Decimal
from functools import reduce





def main():
    n = int(input())
    numbers = input_list()
    ans = []
    s = reduce(lambda a, b: a ^ b, numbers)
    for i in range(n):
        ans.append(s ^ numbers[i])
    print(*ans)


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


def bfs(H, W, black_cells, dist):
    d = 0
    while black_cells:
        h, w = black_cells.popleft()
        d = dist[h][w]
        for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
            new_h = h + dy
            new_w = w + dx
            if new_h < 0 or H <= new_h or new_w < 0 or W <= new_w:
                continue
            if dist[new_h][new_w] == -1:
                dist[new_h][new_w] = d + 1
                black_cells.append((new_h, new_w))
    return d


def input_list():
    return list(map(int, input().split()))


def input_list_str():
    return list(map(str, input().split()))


if __name__ == "__main__":
    main()

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

ans = []
for i in range(N):
    s = val ^ A[i]
    ans.append(s)

print(*ans)

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

sum_A = 0
for item in A:
  sum_A ^= item

ans = [str(sum_A ^ item) for item in A]
print(" ".join(ans))

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

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

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

s=a[0]
for i in range(1,n):
    s^=a[i]
ans=[]
for i in range(n):
    ans.append(s^a[i])
print(*ans)

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

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
S = A[0]
for i in range(1,N):
    S = S^A[i]
B = []
for j in range(N):
    B.append(str(S^A[j]))
print(' '.join(B))

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

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

Solution (Python):
import sys,math,collections,itertools
input = sys.stdin.readline

N=int(input())
a=list(map(int,input().split()))
xa=a[0]
for i in range(1,len(a)):
    xa ^= a[i]
b = []
for ai in a:
    b.append(xa^ai)
print(*b)

Solution (Python):

import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    _ = II()
    a = LI()

    ans = []
    all_xor = 0
    for _a in a:
        all_xor ^= _a

    for _a in a:
        ans.append(all_xor ^ _a)
    print(*ans, sep=" ")


main()

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

Solution (Python):
import sys
def Ii():return int(sys.stdin.readline())
def Mi():return map(int,sys.stdin.readline().split())
def Li():return list(map(int,sys.stdin.readline().split()))

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

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

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

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
x = 0
ans = list()
for ai in A:
  x = x ^ ai
for ai in A:
  ans.append(x ^ ai)
print(*ans)

Solution (Python):
from functools import reduce
import sys

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

N = I()
a = LI()

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

Solution (Python):
def solve(ls):
    n = len(ls)
    s = 0
    for i in range(n):
        s ^= ls[i]

    result = [0] * n
    for i in range(n):
        result[i] = s ^ ls[i]
    return result


def main(istr, ostr):
    (n,) = list(map(int, istr.readline().strip().split()))
    ls = list(map(int, istr.readline().strip().split()))
    result = solve(ls)
    print(*result, file=ostr)


if __name__ == "__main__":
    import sys

    main(sys.stdin, sys.stdout)

Solution (Python):
import sys
import numpy as np
from math import ceil as C, floor as F
from collections import defaultdict as D
from functools import reduce
 
alp = 'abcdefghijklmnopqrstuvwxyz'
def S(): return sys.stdin.readline().rstrip().split(' ')
def Ss(): return list(S())
def I(): return _I(S())
def Is(): return list(I())
def _I(ss): return map(int, ss) if len(ss) > 1 else int(ss[0])
 
_ = I()
xs = Is()

def xor(x, y):
  return int('{0:b}'.format(x), 2) ^ int('{0:b}'.format(y), 2)

def xors(xs):
  return reduce(xor, xs)

xxx = xors(xs)
ys = [str(xor(xxx, x)) for x in xs]
print(' '.join(ys))

Solution (Python):
from functools import reduce

N = int(input())
A = [int(x) for x in input().split()]
SUM=reduce(lambda a, b: a^b, A)

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

Solution (Python):
def main():
    N = int(input())
    a = list(map(int,input().split()))
    allxor = a[0]
    for i in range(N):
        if i == 0:
            continue

        allxor = allxor ^ a[i]

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

    return(ans)

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

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

count = 0
for k in a:
    count ^= k


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

Solution (Python):
def inputlist(): return [int(j) for j in input().split()]

N = int(input())
a = inputlist()

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

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

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
ans = [-1] * n
total = 0

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

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

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

mlt=0

for a in A:
  mlt^=a

for i in range(N):
  print(mlt^A[i],end=" ")

Solution (Python):
N = int(input())
arr = list(map(int, input().split()))
s = 0
for i in range(N):
    s ^= arr[i]
for i in range(N):
    arr[i] ^= s
print(' '.join(map(str, arr)))

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

x = 0
for i in a:
  x ^= i
print(*list(x^i for i in a))

Solution (Python):
b=int(input())
a=list(map(int,input().split()))
ans=""
total=0
for i in a:
  total^=i
for i in a:
  ans+=str(total^i)+" "
print(ans)

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


for i in range(n):
    print(count ^ a[i], end=" ")

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

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

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

def solve():
    tot = reduce(xor, A, 0)
    return ' '.join(map(str, [a ^ tot for a in A]))

if __name__ == "__main__":
    print(solve())

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
xor = A[0]

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

ans = map(str,[i^xor for i in A])

print(' '.join(ans))

Solution (Python):
import time
start = time.time()
n = int(input())
a = list(map(int,input().split()))
b = []
m = 0
for i in range(1,n):
    m = m ^ a[i]
b.append(m)
for j in range(1,n):
    m = m ^ a[j-1]
    m = m ^ a[j]
    b.append(m)
b = map(str,b)
print(' '.join(b))

Solution (Python):

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

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

print(' '.join([str(aa^a) for a in A]))

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

Solution (Python):
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter
from operator import mul
from functools import reduce

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

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

sol = [str(m^a[i]) for i in range(n)]
print(' '.join(sol))

Solution (Python):
import functools
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):
n = int(input())
a_list = list(map(int, input().split()))
base_xor = 0
for i in a_list:
    base_xor = base_xor^i
ans = [0]*n
for i in range(n):
    ans[i] = a_list[i]^base_xor
ans = " ".join([str(i) for i in ans])
print(ans)

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

S=a[0]
for i in range(1,len(a)):
  S ^= a[i]

ans = []
for i in range(len(a)):
  ans.append(str(S^a[i]))
print(' '.join(ans))