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):
import sys, bisect, math, itertools, string, queue, copy



from collections import Counter,defaultdict,deque
from itertools import permutations, combinations, combinations_with_replacement
from heapq import heappop, heappush, heapify
from fractions import gcd

sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    n = inp()
    a = inpl()
    x = 0
    for i in range(n):
        x = x^a[i]
    ans = [x^a[i] for i in range(n)]
    print(*ans)
if __name__ == "__main__":
    main()

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

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

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

Solution (Python):
import math

import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit


ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n = int(ipt())
    a = [int(i) for i in ipt().split()]
    sxr = 0
    for i in a:
        sxr = sxr^i
    ans = []
    for i in a:
        ans.append(str(i^sxr))
    print(" ".join(ans))

    return

if __name__ == '__main__':
    main()

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

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

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

solve()

Solution (Python):
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)

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

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

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

Solution (Python):


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




x = a[0]
for k in range(n - 1):
    x = x ^ a[k + 1]

bb = []
for k in range(n):
    b = x ^ a[k]
    bb.append(b)
print(" ".join(map(str, bb)))

Solution (Python):


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

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

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

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

def solve(A):
    x = 0
    for a in A:
        x ^= a
    print(*[x ^ a for a in A])

solve(A)

Solution (Python):
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")

INF = float("inf")


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

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

al = 0
for aa in a:
    al=al^aa
    
ans=[aa^al for aa in a]
print(*ans)

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

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

print(" ".join(ans))

Solution (Python):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    T = 0
    for a in A:
        T ^= a
    return [T ^ a for a in A]

print(*main())

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

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 Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10 ** 18
MOD = 10**9+7


Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

n = int(ri())
a = Ri()

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

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

print(*ans)

Solution (Python):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    r = 0
    l = []
    for i in A:
        r ^= i
    for i in A:
        l.append(r^i)
    print(' '.join([str(i) for i in l]))
main()

Solution (Python):
inpl = lambda: list(map(int,input().split()))
N = int(input())
A = inpl()
S = 0
for a in A:
    S ^= a
ans = [ str(S^a) for a in A ]
print(' '.join(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):
n = int(input())
a = [int(i) for i in input().split()]
pari = [0] * 30
for i in range(30):
    for j in a:
        pari[i] += (j&(1<<i))>>i

ans = a[:]

for i in range(30):
    if pari[i]%2:
        for j in range(n):
            if a[j]&(1<<i):
                ans[j] -= 1<<i
            else:
                ans[j] += 1<<i

print(' '.join([str(i) for i in ans]))

Solution (Python):
import sys
from collections import defaultdict, deque
import math








input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 998244353

def solve():
    n = getN()
    nums = getList()
    xors = [[] for i in range(31)]
    for num in nums:
        for i in range(31):
            if num % 2 == 1:
                xors[i].append(1)
            else:
                xors[i].append(0)

            num //= 2
    
        

    ans = [0 for i in range(n)]

    for digit, xo in enumerate(xors):
        if sum(xo) % 2 == 0:
            
            for i, x in enumerate(xo):
                if x == 1:
                    ans[i] += 2 ** digit

        else:
            
            for i, x in enumerate(xo):
                if x == 0:
                    ans[i] += 2 ** digit


    print(*ans)
def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    
    solve()

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

    for a in A:
        print(a ^ total)

    return


if __name__ == '__main__':
    main()

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

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

ans=[v^S for v in A]
print(" ".join(map(str,ans)))

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

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


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

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = LI()
b = a[0]
for i in a[1:]:
    b ^= i
ans = []
for i in a:
    ans.append(b^i)
print(*ans)

Solution (Python):

n = int(input())
arr = list(map(int, input().split()))
m = 0
for i in arr:
    m = m^i
b = []
for i in arr:
    b.append(m^i)
print(*b)

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

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

A = list(map(int, input().split()))
key = 0
for a in A:
    key ^= a
ans = []
for a in A:
    ans.append(a^key)

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

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

Solution (Python):
import sys

N=int(sys.stdin.readline())

A=[int(i) for i in sys.stdin.readline().split()]

ans=[0]*N

total=0

for x in range(N):
	total^=A[x]

for y in range(N):
	ans[y]=str(total^A[y])

print(" ".join(ans))

Solution (Python):
from collections import deque,defaultdict as dd 
from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
from itertools import permutations
from datetime import datetime
from math import ceil,sqrt,log,gcd
def ii():return int(input())
def si():return input()
def mi():return map(int,input().split())
def li():return list(mi())
abc='abcdefghijklmnopqrstuvwxyz'
abd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod=1000000007

inf = float("inf")
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]

def bo(i):
    return ord(i)-ord('a')



n=ii()
a=li()
x=0
for i in a:
    x^=i
    
ans=[]
for i in range(n):
    ans.append(x^a[i])
print(*ans)

Solution (Python):
def main():
    n = int(input())
    a = tuple([int(t)for t in input().split()])

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

    ans = []
    for a_i in a:
        ans.append(base^a_i)

    print(*ans)


if __name__ == "__main__":
    main()

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

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

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

xor_left = [0]
for a in A:
    xor_left.append(xor_left[-1] ^ a)
xor_left.append(0)

xor_right = [0]
for a in A[::-1]:
    xor_right.append(xor_right[-1] ^ a)
xor_right.append(0)
xor_right = xor_right[::-1]

ans = []
for i in range(1, N + 1):
    ans.append(xor_left[i - 1] ^ xor_right[i + 1])
print(*ans, sep=' ')

Solution (Python):
from functools import *
from operator import *

N = int(input())
a = list(map(int, input().split()))
total = reduce(xor, a, 0)

print(" ".join(list(map(lambda ai: str(ai^total), a))))

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

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

out = []
for v in a:
   ans = base ^ v
   out.append(str(ans))
print(" ".join(out))

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

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

ans = [sA^a for a in A]
print(' '.join(map(str, ans)))

Solution (Python):
def solve(n, a_list):
    s = 0
    for i in range(n):
        a = a_list[i]
        s = s ^ a
    res_list = []
    for i in range(n):
        a = a_list[i]
        res_list.append(str(s ^ a))
    
    return " ".join(res_list)


def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    res = solve(n, a_list)
    print(res)


def test():
    assert solve(4, [20, 11, 9, 24]) == "26 5 7 22"


if __name__ == "__main__":
    test()
    main()

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

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

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

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

ans = [S^a for a in As]
print(*ans)

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

for a in A:
    print(a ^ res)

Solution (Python):

N = int(input())

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

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

ans = []

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

print (*ans)

Solution (Python):
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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


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


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

Solution (Python):
import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

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


def main():
	N = int(input())
	A = getlist()
	XOR = 0
	for i in range(N):
		XOR = XOR ^ A[i]


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

	print(*ans)


if __name__ == '__main__':
	main()

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

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

s = reduce(xor, A)
print(*((s^a) for a in A))

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):
    ans.append(x ^ a[i])

print(*ans)

Solution (Python):
N = int(input())
A = [int(i) for i in input().split()]
all_xor = 0
for a in A:
    all_xor ^= a
ans = []
for a in A:
    ans.append(all_xor ^ a)
print(*ans)

Solution (Python):
import sys

stdin = sys.stdin


def ni(): return int(ns())


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


def naa(N): return [na() for _ in range(N)]


def ns(): return stdin.readline().rstrip()  


N = ni()
A_array = na()

A = 0

for a in A_array:
    A = A ^ a

ans_array = [A ^ a for a in A_array]

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
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 LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    s=0
    n=II()
    aa=LI()
    for a in aa:s^=a
    ans=[]
    for a in aa:ans.append(a^s)
    print(*ans)

main()

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


if __name__ == '__main__':
    main()

Solution (Python):


import sys
sys.setrecursionlimit(300000)


def solve(N: int, a: "List[int]"):
    s = 0
    for v in a:
        s = s ^ v
    ret = []
    for v in a:
        ret.append(s ^ v)
    print(*ret, sep=' ')
    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):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
a = LIST()

xor = lambda x, y:x^y

X = reduce(xor, a)

ans = [0]*N
for i, x in enumerate(a):
    ans[i] = X^x
print(*ans)

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

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

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

for a in A:
    print(ans^a)

Solution (Python):
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction

sys.setrecursionlimit(int(pow(10,6)))


mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]


n=l()[0]
A=l()
x=A[0]
for i in range(1,n):
    x=x^A[i]
B=[x^A[i] for i in range(n)]
print(*B)

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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
f = []
b = []
now = 0
for ai in a:
    now ^= ai
    f.append(now)
now = 0
for ai in reversed(a):
    now ^= ai
    b.append(now)
b.reverse()
for i in range(n):
    ans = 0
    if i > 0:
        ans ^= f[i-1]
    if i < n-1:
        ans ^= b[i+1]
    print(ans, end=' ' if i < n - 1 else '\n')

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

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

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

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

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

print(*ans)

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

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












an = 0
for i in range(n):
    an ^= A[i]

ANS = []
for i in range(n):
    ANS.append(an^A[i])
print(*ANS)

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
xorsm = 0
for x in a: xorsm ^= x
res = [0] * N
for i in range(N): res[i] = a[i] ^ xorsm
print(*res)

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

Solution (Python):
import sys

sys.setrecursionlimit(1000000)

import bisect
import math
import collections
import heapq


def solve(N, As):
    k = 0
    for a in As:
        k ^= a
    ans = []
    for a in As:
        ans.append(str(k ^ a))
    return " ".join(ans)








if __name__ == "__main__":
    N = int(input())
    As = list(map(int, input().split(" ")))
    print(solve(N, As))

Solution (Python):


input()

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

total_xor = 0

for a in A:
    total_xor = total_xor^a

A = [a^total_xor for a in A]
print(' '.join(map(str, A)))

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

A = 0

for elem in a:
    A ^= elem

ans = [elem ^ A for elem in a]

print(*ans)

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

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

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

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

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

print(*(a ^ total for a in a_list))

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

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

X = reduce(xor, As)

anss = [X^A for A in As]

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

Solution (Python):
def main():
    n = int(input())
    arr = list(map(int,input().split()))
    xor = 0
    for i in arr:
        xor = xor^i

    ans = []
    for i in arr:
        ans.append(xor^i)

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


main()

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

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

for a in A:
    print(xor(a, xor_sum), end=" ")
print()

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

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

print(*ans, sep=" ")

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

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

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

    print(' '.join([str(x) for x in ans]))

if __name__ == '__main__':
    main()

Solution (Python):
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    v = A[0]
    for a in A[1:]:
        v ^= a
    ans = []
    for a in A:
        ans.append(v ^ a)
    print(*ans)


if __name__ == '__main__':
    main()

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

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

ans = [a[i]^sm for i in range(n)]

print(*ans)

Solution (Python):
def solve():
    n = int(input())
    res = 0
    a = list(map(int, input().split()))
    for i in a:
        res ^= i
    for i in a:
        print(res ^ i, end=' ')
    print()


if __name__ == '__main__':
    solve()

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

print(" ".join(str(xorAll ^ x) for x in A))

Solution (Python):
import sys 
from collections import defaultdict
input = lambda:sys.stdin.readline().strip()
n = int(input())
a = list(map(int,input().split()))
all_ = 0
for i in a:
    all_^=i 
for i in range(n):
    print(a[i]^all_,end=" ")
print()

Solution (Python):


import sys
read = sys.stdin.read
readline = sys.stdin.readline

n,*a = map(int,read().split())

from functools import reduce
from operator import xor

v = reduce(xor,a)

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

Solution (Python):
from sys import stdin, stdout
import heapq
import cProfile
from collections import Counter, defaultdict, deque
from functools import reduce
import math


def get_int():
    return int(stdin.readline().strip())


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


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


def solve():
    return

def main():
    n = get_int()
    ls = get_list()
    ans = []
    xor = 0
    for val in ls:
        xor ^= val
    for val in ls:
        ans.append(xor^val)
    print(*ans)


TestCases = False

if TestCases:
    for i in range(get_int()):
        main()
else:
    main()

Solution (Python):
import sys
INF = 1 << 60
MOD = 10**9 + 7 
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    xor = 0
    for a in A:
        xor ^= a
    ans = [xor ^ a for a in A]
    print(*ans)
resolve()

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

n = int(input())
a = [int(x) for x in input().split()]
res = 0

for x in a:
    res ^= x

for x in a:
    print(res ^ x, end = ' ')

Solution (Python):

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
A = lr()
num = A[0]
for a in A[1:]:
    num ^= a

answer = [None] * N
for i, a in enumerate(A):
    answer[i] = num^a

print(*answer)

Solution (Python):





import sys
import heapq

def main():
    n = int(input())
    nums = list(map(int, sys.stdin.readline().split()))

    refVal = nums[0]
    for i in range(1, n):
        refVal ^= nums[i]
    for i in nums:
        print(refVal ^ i, end = " ")
    return

if __name__ == "__main__":
    main()

Solution (Python):
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter

from functools import lru_cache

sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


n = inp()
a = inpl()
all_num = 0
for i in a:
    all_num ^= i
ans = []
for i in a:
    ans.append(all_num ^ i)
print(*ans)

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

X = 0

for x in a:
    X ^= x

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

print(*ans)

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

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

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

print (*ans)

Solution (Python):
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math


MOD = 10 ** 9 + 7



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

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

print(*ans)

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):
from bisect import *
from collections import *
from heapq import *

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

Solution (Python):
N = int(input())
arr = list(map(int, input().split(" ")))
all_xor = 0 
for a in arr :
    all_xor ^= a 

for a in arr :
    print (all_xor^a, end= " ")

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

Solution (Python):

import bisect
import collections
import sys

sys.setrecursionlimit(1000000)
ACMOD = 1000000007
INF = 1 << 62


def solve(N: int, a: "List[int]"):
    total_xor = 0
    for v in a:
        total_xor = total_xor ^ v

    
    
    print(" ".join((str(total_xor^v) for v 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()