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

tmp = li[0]

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

for i in li:
    li2.append(tmp^i)

print(*li2)

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=int(input())
a_array=list(map(int,input().split()))
all_xor=0
for a in a_array:
    all_xor^=a
print(" ".join([str(all_xor^a) for a in a_array]))

Solution (Python):
def main():
    import sys
    read = sys.stdin.buffer.read
    readline = sys.stdin.buffer.readline
    readlines = sys.stdin.buffer.readlines
    sys.setrecursionlimit(10 ** 7)

    n = int(readline())
    a = list(map(int, readline().split()))
    memo = 0
    for aa in a:
        memo ^= aa
    for i in range(n):
        a[i] ^= memo
    print(*a)


if __name__ == '__main__':
    main()

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

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

x = 0
for i in range(N):
    x = x ^ a[i]
    
ANS = [0]*N
for i in range(N):
    ANS[i] = a[i] ^ x

print(*ANS)

Solution (Python):

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

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

ans = [0] * N

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

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_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()

if max(a) == 0:
	print(*[0]*N)
	exit()

n = ceil(log2(max(a)))+1

A = ["{:b}".format(x).zfill(n) for x in a]


b = a[0]
for i in range(1, N):
	b ^= a[i]
b = "{:b}".format(b).zfill(n)


ans = []

for x in A:
	tmp = 0
	for i in range(n):
		tmp += ((int(b[i])+int(x[i]))%2) * (2**(n-1-i))

	ans.append(tmp)

print(*ans)

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

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

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

ans = []

for a in A:
    ans.append(tmp^a)


an_c = str(ans[0])
for an in ans[1:]:
    an_c += " " + str(an)
    
print(an_c)

Solution (Python):
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI0(): return map(lambda s: int(s) - 1, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
def LMI0(): return list(map(lambda s: int(s) - 1, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')

N = I()
A = LMI()

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

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

Solution (Python):
_,a=open(x:=0)
*a,=map(int,a.split())
for i in a:x^=i
for i in a:print(x^i)

Solution (Python):
_,a=open(0)
*a,=map(int,a.split())
x=0
for i in a:x^=i
for i in a:print(x^i)

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

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

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

Solution (Python):
import sys
import math
import collections
import decimal
import itertools
from collections import deque
from functools import reduce
import heapq
n = int(input())


a = list(map(int, sys.stdin.readline().split()))

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

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

Solution (Python):
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from math import factorial, sqrt, ceil, gcd
from functools import lru_cache, reduce
from decimal import Decimal
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def dijkstra_heap(s, edge, n):
    
    d = [10**20] * n
    used = [True] * n 
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


def lcm(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm, numbers, 1)


def gcd_list(numbers):
    return reduce(gcd, numbers)


def is_prime(n):
    if n <= 1:
        return False
    p = 2
    while True:
        if p ** 2 > n:
            break
        if n % p == 0:
            return False
        p += 1
    return True



def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P


def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret



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

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
s = [0] * 30
t = [1] * 30
for i in range(29):
    t[i + 1] = t[i] * 2
ss = a[0]
for j in range(N - 1):
    ss = ss ^ a[j + 1]
for j in range(N):
    print(a[j] ^ ss,end = " ")
print()

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):
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy


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

Solution (Python):
def main():
    import sys
    read = sys.stdin.buffer.read
    readline = sys.stdin.buffer.readline
    readlines = sys.stdin.buffer.readlines
    sys.setrecursionlimit(10 ** 7)

    n = int(readline())
    a = list(map(int, readline().split()))
    ans = [0] * n
    v = 2 ** 30
    for i in range(30):
        v //= 2
        check = [False] * n
        cnt = 0
        for j, aa in enumerate(a):
            if aa >= v:
                a[j] -= v
                check[j] = True
                cnt += 1
        if cnt % 2 == 1:
            for j, c in enumerate(check):
                if not c:
                    ans[j] += v
        else:
            for j, c in enumerate(check):
                if c:
                    ans[j] += v
    print(*ans)


if __name__ == '__main__':
    main()

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

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

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

sum_t = t[0]

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

ans = []

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

print(*ans)

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


if __name__ == '__main__':
    main()

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

    res = []
    xorSum = 0

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

    for i in range(N-1):
        xorSum = xorSum ^ A_reversed[i] ^ A_reversed[i+1]
        res.append(xorSum)
    
    print(" ".join(map(str, res[::-1])))

if __name__ == '__main__':
    main()

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

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

xor_all = 0

for a in A:
    xor_all = xor_all ^ a

ans = []

for a in A:
    ans.append(xor_all ^ a)

print(*ans)

Solution (Python):
n, *a = map(int, open(0).read().split())
base = 0
for x in a:
    base ^= x
print(" ".join([str(x ^ base) for x in a]))

Solution (Python):
import sys











stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def main():
    n = int(stdin.readline().rstrip())
    
    a = list(map(int, stdin.readline().rstrip().split()))
    
    
    
    
    xor = 0
    for i in a:
        xor ^= i

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




main()

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

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

print(*ans)

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

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

allxor = 0

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

anslist = []

for i in range(N):
    anslist.append(allxor ^ a[i])

print(*anslist, sep=' ')

Solution (Python):


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

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

resolve()

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

ans = []

for a in A:
    ans.append(S ^ a)

print(*ans)

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

A = []
total = 0
for i in range(N):
    n = a[i]
    total = bin(total ^ n)
    total = int(total, 0)
    A.append(n)

result = []

for i in range(N):
    tmp = bin(total ^ A[i])
    m = int(tmp, 0)
    result.append(m)

print(*result)

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

Solution (Python):
N = int(input())
List = list(map(int, input().split()))
S=0
for i in List:
    S=int(bin(S^i),2)
for i in List:
    print(int(bin(S^i),2))

Solution (Python):

import sys
import numpy as np


def solve(N: int, a: "List[int]"):
    t = 0
    ans = []
    for i in range(N):
        t ^= a[i]

    for i in range(N):
        ans.append(str(t^a[i]))

    print(' '.join(ans))
    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
for x in a:
    s ^= x
ans = [x^s for x in a]
print(" ".join(map(str, ans)))

Solution (Python):
import numpy as np

n = int(input())
a = list(map(int,input().split()))
now = 0
for i in a:
    now ^= i
li = []
for i in a:
    li.append(i^now)

print(*li)

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

result = ['' for _ in range(N)]
s = A[0]
for i in range(1,N):
    s = s ^ A[i]

for i in range(N):
    result[i] = str(s ^ A[i])

print(' '.join(result))

Solution (Python):
N = int(input())
lis = list(map(int, input().split()))
def calc(vals):
    val, *vals = vals
    for v in vals:
        val ^= v
    return val
ans = []
total = calc(lis)
for val in lis:
    ans.append(total ^ val)
print(*ans)

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(i^b)

print(*ans)

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

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

sm = 0
for a in A:
    sm ^= a
for a in A:
    print(sm^a, end=' ')
print()

Solution (Python):
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x ,sep='\n')

n = ni()
a = nl()
for i,j in enumerate(a):
    if i == 0:
        t = j
        continue
    t = t ^ j
for k in a:
    print(t ^ k)

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

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

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

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

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

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

print(" ".join(str(x) for x in ans))

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

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

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

for i in range(31):
    x=0
    for j in range(n):
        if (a[j]>>i)&1:
            x+=1
    if x%2==0:
        for j in range(n):
            if (a[j]>>i)&1:
                ans[j]+=pow(2,i)
    else:
        for j in range(n):
            if not (a[j]>>i)&1:
                ans[j]+=pow(2,i)

print(*ans)

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

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

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

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

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

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

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

Solution (Python):








def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))



from collections import defaultdict

def main():
	n=II()
	A=LI()

	a=0

	ans=[]

	for i in A:
		a^=i

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

	print(*ans)












if __name__ == "__main__":
	main()

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

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

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

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

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

ans = [SUM ^ a for a in A]

print(*ans)

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

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

for k in range(len(ans)-1):
  print("{} ".format(ans[k]), end="")
print(ans[len(ans)-1])

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
p=[]
for j in range(30):
  p.append(pow(2,j))
t=0
for i in range(n):
  t=t^a[i]
for i in range(n):
  ans=0
  for j in range(30):
    ans=ans+p[j]*(((a[i]^t)//p[j])%2)
  print(ans,end=" ")

Solution (Python):

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

digit = "0"+str(30)+"b"
memo = [None]*(N)





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

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

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


def _i(): return int(sys.stdin.readline().strip())


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


def main():
    _ = _i()
    a = list(_ia())
    s = reduce(xor, a, 0)
    return " ".join(map(str, map(lambda x: s ^ x, a)))


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

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

tmp = int(0)
for t in a:
    tmp ^= t

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

print(*ans)

Solution (Python):
n = int(input())
A=[int(i) for i in input().split()]
k = A[0]
for i in range(n-1):
    k ^= A[i+1]
res = []

for i in A:
    res.append(i^k)
for i in res:
    print(i, end=" ")

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

s = 0
for i in range(N):
  s ^= A[i]
for i in range(N):
  si = s
  si ^= A[i]
  print(si)

Solution (Python):
from functools import reduce

N = int(input())
xs = [int(x) for x in input().split()]
t = reduce(lambda acc, elem: acc ^ elem, xs)

print(*[t ^ x for x in xs])

Solution (Python):
import numpy as np

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

ans=np.zeros(n, dtype=int)

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

for i in range(0,n):
  ans[i]=all ^ np_a[i]
  
print (*ans)

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

allh=alist[0]^alist[1]
for i in range(n-2):
    allh = allh ^ alist[i+2]

outlist=[]
for a in alist:
    outlist.append(str(allh ^ a))
    outlist.append(" ")
outlist.pop()
print("".join(outlist))

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

  X = A[0]

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

  B = []

  for v in A:
    B.append(X ^ v)
  
  print(" ".join(map(str, B)))

if __name__ == "__main__":
  main()

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

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

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

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








first = 0
tmp = 0

for (i, a) in enumerate(A):
    if i == 0:
        first = a
        continue
    else:
        xor = first^a
        tmp = tmp^xor

f = tmp^first
print(f)
for (i, a) in enumerate(A):
    if i == 0:
        continue
    else:
        print(first^f^a)

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



def main():
    N = int(input().strip())
    a_l = [int(i) for i in input().strip().split()]
    ans = [None] * N
    base = 0
    for a in a_l:
        base ^= a
    for i in range(N):
        ans[i] = str(base ^ a_l[i])
    print(" ".join(ans))


if __name__ == "__main__":
    main()

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

res =[]

r = None

for i in range(len(alphas)):
	if r is None:
		r = alphas[i]
	else:
		r ^= alphas[i]

for i in range(len(alphas)):
	res.append(r^alphas[i])
print(*res)

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)

Solution (Python):

"""
@author: H_Hoshigi
"""
def main():
    N = int(input())
    A_lsit = list(map(int, input().split()))
    A_binstr_lsit = [bin(a)[2:].zfill(30) for a in A_lsit]

    is_odd_list = [
        bool(sum([
                int(A_binstr_lsit[j][i])
                for j in range(N)
            ])%2)
        for i in range(30)
    ]

    
    
    

    answer_list = []

    for i in range(N):
        A_bin = A_binstr_lsit[i]
        answer = ""
        for j in range(30):
            if is_odd_list[j]:
                if A_bin[j] == "1":
                    answer += "0"
                else:
                    answer += "1"
            else:
                answer += A_bin[j]
        answer_list.append(str(int(answer, 2)))
    print(" ".join(answer_list))

if __name__ == "__main__":
    main()

Solution (Python):
import sys
import math
from collections import defaultdict, deque
def r():
    return int(input())
def rm():
    return map(int,input().split())
def rl():
    return list(map(int,input().split()))

n=r()
a=rl()
all=a[0]^a[1]
for i in range(2,n):
    all^=a[i]
b=[]
for j in range(n):
    b.append(all^a[j])
print(*b)

Solution (Python):
def solve():
	N = int(input())
	arr = list(map(int, input().split()))
	xor = arr[0]
	for i in range(1, N):
		xor ^= arr[i]
	for x in arr:
		print(x ^ xor, end = " ")
	print()

def main():
	
	solve()


if __name__ == '__main__':
	main()

Solution (Python):
import sys
import time




import math
start=time.time()
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))
n=ri()
a=rl()
t=0
for i in a:
    t^=i
t=bin(t)[2:]
max_len=max(len(bin(max(a)))-2,len(t))

if len(t)<max_len:t="0"*(max_len-len(t))+t
try:
    a=list(map(lambda x : bin(x)[2:],a))
except:
    sys.exit()
    
try:
    for i in range(n):
        if len(a[i])<max_len:
            a[i]="0"*(max_len-len(a[i]))+a[i]
except:
    sys.exit()


ans=[[] for i in range(n)]
for i in range(max_len):
    for j in range(n):  
            if a[j][i]==t[i]:
                ans[j].append("0")
            else:
                ans[j].append("1")

for i in ans:
    print(int("".join(i), 2))

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

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
A = [list(map(int, list('{:031b}'.format(x)))) for x in A]
total = []
for B in zip(*A):
    total.append(sum(B))

ans = []
for a in A:
    tmp = []
    for i in range(31):
        tmp.append(str((total[i]-a[i])%2))
    ans.append(int(''.join(tmp), 2))
print(*ans)

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


ans = []
alld = 0

for aa in a:
    alld = alld ^ aa

for  aa in a:
    ans.append(alld ^ aa)

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

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

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

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

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

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

b = a[:]

dig_m = 30
cnt_dig = [1]*30
for i in range(dig_m):
    cnt = 0
    for j in range(n):
        if b[j] % 2 == 0:
            cnt += 1
        b[j] //= 2
    if cnt % 2 == 0:
        cnt_dig[i] = 0
cnt_dig.reverse()
cnt_dig = int(''.join(map(str, cnt_dig)), 2)

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

Solution (Python):
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
from math import gcd,ceil,floor,factorial

from functools import reduce
from pprint import pprint
from statistics import mean,median,mode

INF = float("inf")

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

def I():
    return int(input())

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

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

def CI(n):
    return [ int(input()) for _ in range(n) ]

def LI(n):
    return [ list(map(int,input().split())) for _ in range(n) ]

def S():
    return input()

def MS():
    return input().split()

def RS():
    return list(input().split())

def CS(n):
    return [ input() for _ in range(n) ]

def LS(n):
    return [ list(input().split()) for _ in range(n) ]

n = I()
a = RI()

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


l = []
for i in a:
    b = i^s
    l.append(b)
myoutput(l,True)

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

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

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

print(*B)

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

if N % 2 == 0:
    s = A[0]
    for i in range(1,N):
        s = s^A[i]
    
    for i in range(N):
        print(s^A[i],end=" ")
    print()
else:
    print()

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