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.



Sample input:
4
20 11 9 24


Sample output:
26 5 7 22

Submission status: Accepted

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

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

for i in a:
    print(s ^ i)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
 
xor = 0
for a in A:
    xor ^= a
 
ans = []
for a in A:
    ans.append(a ^ xor)
print(*ans)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
xor_sum = 0
for i in A:
    xor_sum ^= i
for i in A:
    print(xor_sum ^ i, end=" ")

Submission status: Accepted

Solution code:
n = int(input())

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

s = a[0]

for i in range(1,len(a)):
    s = s ^ a[i]
    
for i in a:
    print(s ^ i,end = " ")

Submission status: Accepted

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

S = 0

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

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
x = 0
for ai in a:
    x ^= ai
for ai in a:
    print(x^ai)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
a_sum = 0
for i in range(len(a)):
    a_sum = a_sum ^ a[i]
anslist = []
for i in range(len(a)):
    anslist.append(str(a_sum ^ a[i]))
print(" ".join(anslist))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())
a = np.array(input().split(), np.int64)

S = a[0]

for i in range(1, n):
    S = np.bitwise_xor(S, a[i]) #xor logic
    #print(format(S, 'b')) decimal number→binary number

for i in range(n):
    print(np.bitwise_xor(S, a[i]))

Submission status: Accepted

Solution code:
import sys
from itertools import accumulate
from operator import xor

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7
EPS = 10 ** -10

N = INT()
A = [0] + LIST() + [0]

acc1 = list(accumulate(A, xor))
acc2 = list(accumulate(A[::-1], xor))[::-1]
ans = [0] * (N+1)
for i in range(1, N+1):
    ans[i] = acc1[i-1] ^ acc2[i+1]
print(*ans[1:])

Submission status: Accepted

Solution code:
#Take xor of all elements in the input, 
#try to extract the value in each position from that.
N = int(input())
A = list(map(int, input().split()))
S = 0
for x in A:
    S ^= x
for i in range(len(A)):
    A[i] ^= S
print(*A)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,A,num=int(input()),list(map(int,input().split())),0
for i in A:num ^=i
for i in A:print(num^i,end=" ")

Submission status: Accepted

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

num=0
for i in A:num ^=i
for i in A:print(num^i,end=" ")

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))#o(10^5)
temp = 0
for a in A:
    temp = temp ^ a
for a in A:
    print(temp ^ a, end=' ')

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
n = int(input())
ls = list(map(int,input().split()))
x =0
for i in ls:
    x ^= i
for j in ls:
    print(x^j,end=" ")

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
s = 0

for x in a:
    s ^= x

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

Submission status: Accepted

Solution code:
ans=0
n=int(input())
lis=input()
lis=lis.split(" ")
for i in range(0,n):
    lis[i]=int(lis[i])
    ans=ans^lis[i]
ans_lis=[]
for i in range(0,n):
    ans_lis.append(lis[i]^ans)
for i in range(0,n):
    print(ans_lis[i],end=" ")

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
s = 0
for x in a:
    s ^= x
ans = ''
for x in a:
    ans += str(s^x) + ' '
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N = inputInt()
	A = inputList()

	total = A[0]
	for i,val in enumerate(A):
		if i == 0:
			continue
		total = total ^ val

	ans = []
	for i,val in enumerate(A):
		tmp =  total ^ val
		ans.append(tmp)

	print(*ans)



#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()

Submission status: Accepted

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

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

print(*b)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
sum = 0
for i in a:
  sum ^= i
for i in a:
  print(sum ^ i,end=' ')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#abc171e
n=int(input())
a=list(map(int,input().split()))
s=0
for i in a:
 s^=i
for i in a:
 print(s^i,end=' ')
print()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def readinput():
    n=int(input())
    a=list(map(int,input().split()))
    return n,a

def main(n,a):
    allxor = a[0]
    for i in range(1,n):
        allxor = allxor ^ a[i]
    b=[0]*n
    for i in range(n):
        b[i]=allxor ^ a[i]
    
    return b

if __name__=='__main__':
    n,a=readinput()
    ans=main(n,a)
    print(' '.join(map(str,ans)))

Submission status: Accepted

Solution code:
from collections import defaultdict as dd
from collections import deque
import bisect
import heapq

def ri():
    return int(input())

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


def solve():
    n = ri()
    A = rl()

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

    print (*[a^X for a in A])






mode = 's'

if mode == 'T':
    t = ri()
    for i in range(t):
        solve()
else:
    solve()

Submission status: Accepted

Solution code:
def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline

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

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

main()

Submission status: Accepted

Solution code:
# Implementation by unihernandez22 || Idea by Vicfred
# https://atcoder.jp/contests/abc171/tasks/abc171_e
# bitwise

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

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

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

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
p=[a[0]]
for i in range(1,n):
  p.append(p[-1] ^ a[i])
  
S=p[-1]
b=[v^S for v in a]
print(*b,sep=' ')

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int,input().split()))
s = 0
for i in range(n) :
    s = s ^ A[i]

ans = [0]*n
for i in range(n) :
    ans[i] = s ^ A[i]

print(*ans)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
a = A[0]
for a_ in A[1:]:
    a ^= a_
Ans = []

for x in A:
    Ans.append(str(x ^ a))
print(' '.join(Ans))

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n = int(readline())
lst1 = list(map(int,readline().split()))
res = 0
for i in lst1:
    res = res^i
ans = []
for i in lst1:
    ans.append(res^i)
print(*ans)

Submission status: Accepted

Solution code:
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()))
res = 0
for i in lst1:
    res = res^i
ans = []
for i in lst1:
    ans.append(res^i)
print(*ans)

Submission status: Accepted

Solution code:
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, end = " ")

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.readline


def main():
    N = int(readline())  # 偶数
    A = list(map(int, readline().rstrip().split()))  # [自分以外の全ての整数のxor, ...]
    
    xor = 0
    for a in A:
        xor ^= a
    
    res = [a ^ xor for a in A]
    print(*res)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from operator import xor
from functools import reduce
n = int(input())
A = list(map(int, input().split()))
total = reduce(xor, A)
print(*[total ^ a for a in A])

Submission status: Accepted

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

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


for i in a:
    print(allxor ^ i)

Submission status: Accepted

Solution code:
n,*a=map(int,open(0).read().split())
ans=0
for i in a:
  ans^=i 
for i in a:
  print(ans^i,end=" ")

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gcd
from operator import mul
from functools import reduce
from operator import mul
import pprint



sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n = I()
A = LI()
ret = 0
for i in A:
    ret ^= i

for j in A:
    print(ret ^ j)

Submission status: Accepted

Solution code:
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = list(map(int,readline().split()))
total = 0
ans = []
for a in A:
    total^=a
for a in A:
    ans.append(str(total^a))
print(' '.join(ans))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
su = 0
for i in a:
  su ^= i
for i in a:
  print(su^i,end=' ')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
X=0
for e in A:
  X=X^e
for e in A:
  print(X^e,end=" ")

Submission status: Accepted

Solution code:
num = int(input())
a_i = list(map(int, input().split()))
s = 0
for x in a_i:
    s ^= x
ans = []
for x in a_i:
    ans.append(x ^ s)
print(' '.join(map(str, ans)))

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
X = 0
for ai in a:
    X ^= ai
for ai in a:
    print(ai ^ X, end=' ')
print('')

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

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

tmp = 0
for num in a:
    tmp ^= num

ans = []
for num in a:
    ans.append(tmp^num)

print(*ans)

Submission status: Accepted

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

tmp = a[0]
ans = [0]*N

for i in range(1,N):
    tmp ^= a[i]
    
for i in range(N):
    ans[i] = tmp^a[i]
    
print(*ans)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
X = a[0]
for i in range(1, N):
    X ^= a[i]
for ai in a:
    print(ai ^ X, end=' ')
print('')

Submission status: Accepted

Solution code:
import numpy as np

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

S = np.bitwise_xor.reduce(A)
print(*(A ^ S))

Submission status: Accepted

Solution code:
def mi(): return map(int,input().split())
def lmi(): return list(map(int,input().split()))
def ii(): return int(input())
def isp(): return input().split()



n=ii()
a=lmi()
S=0
for i in a:
  S=S^i

b=[]
for i in a:
  a_=S^i
  b.append(a_)

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

Submission status: Accepted

Solution code:
from functools import reduce


def xor(a, b):
    return a ^ b


def main():
    N = int(input())
    A = list(map(int, input().split()))
    total_xor = reduce(xor, A)
    vals = map(lambda v: total_xor ^ v, A)
    print(' '.join(map(str, vals)))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
t = 0
for e in a:
    t ^=e #^=は排他的論理和
print(*[e ^ t for e in a])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int, input().split()))
a=A[0]
for i in range(1,N):
  a=a^A[i]
D=[]
for i in range(N):
  D.append(a^A[i])
print(*D)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
A = [*map(int, input().split())]
# print(n)
# print(A)
all_xor = 0
for a in A: all_xor ^= a
# print(all_xor)
ans = []
for a in A: ans.append(all_xor ^ a)
print(*ans,sep=' ')

Submission status: Accepted

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

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

print(' '.join([str(s ^ v) for v in A]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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 (*ans)

Submission status: Accepted

Solution code:
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	n = int(input())
	#b , c = tin()
	#s = input()
	al = lin()
	aax=0
	for v in al:
		aax = aax^v
	ret = [v^aax for v in al]
	print(*ret)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Accepted

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

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

ANS = [x ^ a for a in A]

print(*ANS)

Submission status: Accepted

Solution code:
import sys
import functools


def log(s):
    # print("| " + str(s), file=sys.stderr)
    pass


def output(x):
    print(x, flush=True)


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


def main():
    input()  # n
    aa = input_ints()

    x = functools.reduce(lambda a, b: a ^ b, aa)

    print(" ".join([str(x^a) for a in aa]))


main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import collections
input = sys.stdin.readline

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

Submission status: Accepted

Solution code:
#!python3

LI = lambda: list(map(int, input().split()))

# input
N = int(input())
A = LI()


def main():
    s = 0
    for a in A:
        s ^= a
    ans = [s ^ a for a in A]
    print(*ans) 


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
 
# from math import factorial as fac
from collections import defaultdict
# from copy import deepcopy
import sys, math
f = None
try:
	f = open('q1.input', 'r')
except IOError:
	f = sys.stdin
if 'xrange' in dir(__builtins__):
	range = xrange
# print(f.readline())
sys.setrecursionlimit(10**2)

	
def print_case_iterable(case_num, iterable):
	print("Case #{}: {}".format(case_num," ".join(map(str,iterable))))

def print_case_number(case_num, iterable):
	print("Case #{}: {}".format(case_num,iterable))

def print_iterable(A):
	print (' '.join(A))

def read_int():
	return int(f.readline().strip())
def read_int_array():
	return [int(x) for x in f.readline().strip().split(" ")]
def rns():
	a =  [x for x in f.readline().split(" ")]
	return int(a[0]), a[1].strip()
def read_string():
	return list(f.readline().strip())
def ri():
	return int(f.readline().strip())
def ria():
	return [int(x) for x in f.readline().strip().split(" ")]
def rns():
	a =  [x for x in f.readline().split(" ")]
	return int(a[0]), a[1].strip()
def rs():
	return list(f.readline().strip())
def bi(x):
	return bin(x)[2:]





from collections import deque
import math
# NUMBER = 10**9 + 7
NUMBER = 998244353
def factorial(n) : 
	M = NUMBER
	f = 1
  
	for i in range(1, n + 1):  
		f = (f * i) % M # Now f never can  
						# exceed 10^9+7  
	return f
def mult(a,b):
	return (a * b) % NUMBER

def minus(a , b):
	return (a - b) % NUMBER

def plus(a , b):
	return (a + b) % NUMBER

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		g, y, x = egcd(b % a, a)
		return (g, x - (b // a) * y, y)

def modinv(a):
	m = NUMBER
	g, x, y = egcd(a, m)
	if g != 1:
		raise Exception('modular inverse does not exist')
	else:
		return x % m
def choose(n,k):
	if n < k:
		assert false
	return  mult(factorial(n), modinv(mult(factorial(k),factorial(n-k))))
from collections import deque, defaultdict 
import heapq


from types import GeneratorType
def bootstrap(f, stack=[]):
	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to

	return wrappedfunc


def dfs(g, timeIn, timeOut,depths,parents): 
	# assign In-time to node u 
	cnt = 0
	# node, neig_i, parent, depth
	stack = [[1,0,0,0]]
	while stack:
		v,neig_i,parent,depth = stack[-1]
		parents[v] = parent
		depths[v] = depth
		# print (v)
		if neig_i == 0:
			timeIn[v] = cnt    
			cnt+=1
		while neig_i < len(g[v]):
			u = g[v][neig_i]
			if u == parent:
				neig_i+=1
				continue
			stack[-1][1] = neig_i + 1
			stack.append([u,0,v,depth+1])
			break
		if neig_i == len(g[v]):
			stack.pop()
			timeOut[v] = cnt
			cnt += 1
  
def isAncestor(u: int, v: int, timeIn: list, timeOut: list) -> str: 
	return timeIn[u] <= timeIn[v] and timeOut[v] <= timeOut[u] 

cnt = 0
@bootstrap
def dfs(v,adj,timeIn, timeOut,depths,parents,parent=0,depth=0):
	global cnt
	parents[v] = parent
	depths[v] = depth
	timeIn[v] = cnt
	cnt+=1
	for u in adj[v]:
		if u == parent:
			continue
		yield dfs(u,adj,timeIn,timeOut,depths,parents,v,depth+1)
	timeOut[v] = cnt
	cnt+=1
	yield 


def solution(a,n):
	dp = [0]
	for x in a:
		dp.append(dp[-1] ^ x)
	res= []
	for i in range(n):
		right_side_xor = dp[n]^dp[i+1]
		left_side_xor = dp[i]
		res.append(right_side_xor ^ left_side_xor)
	return ' '.join(map(str,res))

	
def main():
	T = 1
	# T = ri()
	for i in range(T):
		# s = rs()
		n = ri()
		a = ria()
		# n,k = ria()
		# a=ria()

		x = solution(a,n)
		if 'xrange' not in dir(__builtins__):
			print(x)
		else:
			print >>output,str(x)# "Case #"+str(i+1)+':',
	if 'xrange' in dir(__builtins__):
		print(output.getvalue())
		output.close()

if 'xrange' in dir(__builtins__):
	import cStringIO
	output = cStringIO.StringIO()
#example usage:
#    for l in res:
#       print >>output, str(len(l)) + ' ' +  ' '.join(l)

if __name__ == '__main__':
	main()

Submission status: Accepted

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

L = 0
for a in A:
    L ^= a
for a in A:
    print(L ^ a)

Submission status: Accepted

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

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

ans2 = []
for i in range(N):
    ans2.append(ans1 ^ A[i])

print(*ans2)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

# aの要素すべてのXOR、sを求めます
s = a[0]
for num in a[1:]:
    s ^= num

    
# i番目は、s xor a_iです
res = [0] * n
for i, num in enumerate(a):
    res[i] = s ^ num

print(*res)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = 0
for i in a:
	b ^= i
print(" ".join(map(lambda x: str(b ^ x), a)))

Submission status: Accepted

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