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
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]



def make_adjlist_d(n, edges):
    res = [[] for _ in range(n + 1)]
    for edge in edges:
        res[edge[0]].append(edge[1])
        res[edge[1]].append(edge[0])
    return res


def make_adjlist_nond(n, edges):
    res = [[] for _ in range(n + 1)]
    for edge in edges:
        res[edge[0]].append(edge[1])
    return res



def cmb(n, r):
    return math.factorial(n) // math.factorial(r) // math.factorial(n - r)


def main():
    N = NI()
    A = NLI()
    all_xor = 0
    for a in A:
        all_xor ^= a
    L = list(map(lambda x: x^all_xor, A))
    print(" ".join(map(str, L)))

if __name__ == "__main__":
    main()

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

print(*ans)

Solution (Python):

import sys
input = sys.stdin.readline
from collections import Counter

n = int(input())
a = [int(item) for item in input().split()]

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

ans = [0] * n
for i, item in enumerate(a):
    ans[i] = total ^ item
print(*ans)

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

N = int(input())
AS = list(map(int, input().split()))
if N == 2:
    print(*AS, sep=" ")
    exit()
if N == 3:
    r0 = 0
    r1 = r0 ^ AS[2]
    r2 = r1 ^ AS[0]
    print(r0, r1, r2)
    exit()

"""
input
0b00000000000000000000000010100
0b00000000000000000000000001011
0b00000000000000000000000001001
0b00000000000000000000000011000

output
0b00000000000000000000000011010
0b00000000000000000000000000101
0b00000000000000000000000000111
0b00000000000000000000000010110

myanswer
0b00000000000000000000000000000
0b00000000000000000000000011111
0b00000000000000000000000011101
0b00000000000000000000000001100
"""


r = [0] * N
for i in range(1, N):
    r[i] = r[i - 1] ^ AS[i - 1] ^ AS[i]




rest = reduce(xor, r[1:])
d = AS[0] ^ rest
for i in range(N):
    r[i] ^= d

print(*r)

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

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

ans = a[0]

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

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

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

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

    for aa in a:
        print(tmp ^ aa)


if __name__ == "__main__":
    main()

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    N = int(readline())
    A = [int(i) for i in readline().split()]
    SXOR = A[0]
    for i in range(1, N):
        SXOR ^= A[i]
    for a in A:
        print(SXOR^a, end=" ")
if __name__ == '__main__':
    main()

Solution (Python):
import sys
sys.setrecursionlimit(10**6)

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









su = 0

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

for i in range(n-1):
    su = su ^ a[i] ^ a[i+1]
    ans.append(su)
    
print(*ans)

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

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

for i in range(n):
    print(a_xor ^ a[i])

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

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

ans = [None]*n

acm = 0

for i in range(0,n-2,2):
  acm ^= ls[i]^ls[i+1]
  
ans[-1] = ~ls[-2]^(~acm)  

for i in range(n-1):
  ans[i] = ~ans[-1]^(~(ls[-1]^ls[i]))

s = ""
for a in ans:
  s += str(a)+" "
  
print(s)

Solution (Python):
import math
import fractions
import collections
import itertools
import pprint
N=int(input())
a=list(map(int,input().split()))
ex=a[0]
for i in range(1,N):
    ex=ex^a[i]
l=[]
for i in range(N):
    l.append(ex^a[i])
print(*l)

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

Solution (Python):
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    ans = []
    s = 0
    for ai in a:
        s = s ^ ai
    for i in range(n):
        ans.append(s ^ (a[i]))
    print(*ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

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

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

l=[]
for i in a:
    l.append(m^i)
print(*l)

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

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

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

xorall = 0

for aa in a:
    xorall ^= aa

ans = []

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

print(*ans,sep=' ')

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

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

total = 0

for num in a:
    total = total ^ num

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

print('')

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

a_bin = [[] for _ in range(N)]
len_max = 0

odd_or_even = [0 for _ in range(30)]

for i in range(N):
    a_bin[i] = format(a[i],"030b")
    for j in range(30):
        odd_or_even[j] = (odd_or_even[j]+int(a_bin[i][j]))%2

x = [[0]*30 for _ in range(N)]

for i in range(30):
    if odd_or_even[i] == 1:
        for j in range(N):
            x[j][i] = (int(a_bin[j][i])+1)%2
    else:
        for j in range(N):
            x[j][i] = int(a_bin[j][i])

for j in range(N):
    temp = 0
    for i in range(30):
        temp += x[j][i]*(2**(29-i))
    print(temp)

Solution (Python):


import sys; import math; from collections import *


def get_ints(): return map(int, input().split())
def get_list(): return list(get_ints())
def printspx(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")

UGLYMOD = int(1e9+7); SEXYMOD = 998244353; MAXN = int(1e5)




from functools import reduce
n = int(input())
li = get_list()
xo = reduce(lambda x, y: x ^ y, li)
for i in li:
    printsp(i ^ xo)
print()



'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS MINE @luctivud ( UDIT GUPTA )
Link may be copy-pasted here if it's taken from other source.
DO NOT PLAGIARISE.
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()

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

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

    for a in A:
        print(v ^ a)

if __name__ == '__main__':
    main()

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

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

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

ans = []
for i in a:
    ans += [x^i]
print(*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]

for i in range(n):
  print(all ^ a[i])

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

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

ANS = []
for a in A:
    ANS.append(T ^ a)

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

Solution (Python):
from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
bit = [0]*32
for i in A:
    for ind,j in enumerate(format(i,"32b")):
        if j == "1":
            bit[ind] += 1

bit.reverse()
for i in A:
    ans = 0
    tmp = 1
    for j,k in zip(bit,format(i,"32b")[::-1]):
        if k == "1":
            j -= 1
        
        if j % 2 != 0:
            ans += tmp
        tmp *= 2
    print(ans)

Solution (Python):

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

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

answer = [a[i]^all_xor for i in range(N)]

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

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

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

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

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

print(*ans)

Solution (Python):
import sys
def input():
    return sys.stdin.readline()[:-1]
def main():
    N = int(input())
    A = list(map(int,input().split()))
    t = 0
    for e in A:
        t ^= e
    print(*[A[k]^t for k in range(N)])
if __name__ == '__main__':
    main()

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):
N = int(input())
a = list(map(int,input().split()))
xor = 0
for i in a:
    xor ^= i
for i in range(N):
    if i != (N - 1):
        print(xor ^ a[i],end = " ")
    else: print(xor ^ a[i])

Solution (Python):
from sys import stdin
from collections import defaultdict as dd
from collections import deque as dq
import itertools as it
from math import sqrt, log, log2
from fractions import Fraction

n = int(input())
xors = list(map(int, stdin.readline().split()))
nums = []
a1 = 0
for i in xors[1:]:
    a1^= i
nums.append(a1)
for i in xors[1:]:
    nums.append(xors[0]^a1^i)

print(*nums)

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

total = 0
for num in nums:
    total ^= num
ans = []
for i in range(n):
    ans.append(nums[i] ^ total)
print(' '.join(map(str, ans)))

Solution (Python):
N=input()
lst=list(map(int,input().split()))
s=0
for i in lst:
    s^=i
for i in lst:
    print(s^i,end=' ')

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

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


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

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

print(*ans)

Solution (Python):
from functools import reduce

n = int(input())
a = [int(s) for s in input().strip().split()]

all_xor = reduce(lambda x,y:x^y, a)
ans = [str(x ^ all_xor) for x in a]
print(" ".join(ans))

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(readline())
    a = list(map(int, readline().split()))

    s = a[0]

    for x in a[1:]:
        s ^= x

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

    print(*res)


if __name__ == '__main__':
    main()

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

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(" ".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 range(n):
    temp=A[i]^all
    ans.append(temp)

print(*ans)

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


ans = []
for num in A:
    ans.append(total^num)
print(*ans, sep=" ")

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 copy
def main():

    N = int(input())
    A =list(map(int, input().split()))
    AD = copy.copy(A)
    AAA = []

    while len(AD) > 1:
        if len(AD)%2==1:
            AD.append(0)
        for i in range(0,len(AD),2):
            AAA.append(AD[i]^AD[i+1])
        AD = copy.copy(AAA)
        AAA.clear()
    
    for i in range(N):
        A[i] = AD[0] ^ A[i]
    
    print(*A)





if __name__ == '__main__':
    main()

Solution (Python):

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

first_num = 0
for i in range(1, N):
    first_num ^= a_list[i]

ans_list = [first_num]
now_num = first_num
for i in range(1, N):
    now_num ^= a_list[i - 1] ^ a_list[i]
    ans_list.append(now_num)

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

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
bina=['0'*30+bin(ai)[2:] for ai in a]
maxa=max(a)
m=len(bin(maxa))-2
ans=[0]*n
for i in range(m):
  j=-i-1
  tmp=0
  for k in range(n):
    tmp+=int(bina[k][j])
  for k in range(n):
    if tmp%2==0 and bina[k][j]=='1':
      ans[k]+=pow(2,i)
    elif tmp%2==1 and bina[k][j]=='0':
      ans[k]+=pow(2,i)
print(' '.join(map(str,ans)))

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

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

ans = [str(p)]
for i in range(1, N):
    t = A[i-1] ^ A[i]
    p = p ^ t
    ans.append(str(p))
print(" ".join(ans))

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

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

ans = [str(allxor ^ a[i]) for i in range(0,N,1)]

print(" ".join(ans))

Solution (Python):
N = int(input())
l = [int(x) for x in input().split()]
t = 0
for i in l:
    t = t ^ i
for i in range(N-1):
    print(t ^ l[i], end=' ')
print(t ^ l[N-1])

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

Solution (Python):
import math



n=int(input())
l=[int(x) for x in input().split()]
p=[l[0]]
s=[l[-1]]
for i in range(1,len(l)):
	p.append(p[-1]^l[i])
for i in range(len(l)-2,-1,-1):
	s.append(s[-1]^l[i])
s=s[::-1]
ans=[s[1]]
for i in range(1,len(l)-1):
	ans.append(p[i-1]^s[i+1])
ans.append(p[-2])
print(*ans)

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

Solution (Python):
N = int(input())
N_arr = [int(v) for v in input().split()]  

total_ans = 0
for Ni in N_arr:
  total_ans ^= Ni
for i in range(N):
  ans = total_ans ^ N_arr[i]
  print(ans)

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

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

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

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

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

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

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

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

cnt = A[0]
for i in A[1:]:
    cnt ^= i

lst = []
for i in A:
    lst.append(i^cnt)
print(*lst)

Solution (Python):


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
lis=LI()
ans=[[0]*35 for i in range(n)]



for i in range(35):
    bits=[0 for j in range(n)]
    for k in range(n):
        bits[k]=(lis[k]>>i) %2
    
    ans[0][i]=sum(bits[1:])%2
    sm=sum(bits[1:])%2+bits[0]%2
    for k in range(1,n):
        ans[k][i]=(bits[k]-sm)%2

answer=[0 for i in range(n)]
for i in range(n):
    for j in range(35):
        answer[i]+=ans[i][j]*(2**j)
print(*answer)

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

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



for i in a_list:
  print(total^i,end=" ")

Solution (Python):
N = int(input())
A = [int(x) for x in input().split()]
X = 0
for a in A:
    X ^= a
ans = [str(X ^ a) for a in A]
print(' '.join(ans))

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

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

m = reduce(xor, A)
S = [str(a ^ m) for a in A]
print(' '.join(S))

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

cnt = 0
for i in a:
    cnt ^= i
for i in a:
    print(cnt ^ i)

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 j in range(N):
    ans.append(a[j]^s)
print(*ans)

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

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

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

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

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

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

print(" ".join(ans))

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

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

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

Solution (Python):
from functools import reduce

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

all = reduce(lambda i, j: int(i) ^ int(j), a)

for i in range(n):
    print(all ^ a[i])

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

XOR_all = a[0]
for i in range(N-1):
    XOR_all = XOR_all ^ a[i+1]


ans = []
for i in range(N):
    p = a[i]
    ans.append(p^XOR_all)

print(*ans)

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

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

  
print(*B)

Solution (Python):




n = int(input())
a = list(map(int,input().split()))
nans = [''] * n


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

for i in range(n):
    nans[i] = str(axor ^ a[i])


print(' '.join(nans))

Solution (Python):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7






N = getN()
A = getList()

lista = [[0, 0] for i in range(61)]

def splitbit(n):
    for i in range(61):
        if n & (1 << i):
            lista[i][0] += 1
        else:
            lista[i][1] += 1

for i in range(N):
    splitbit(A[i])

bi_int = 0
for i in range(61):
    if lista[i][0] % 2 == 1:
        bi_int += 2 ** i

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

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

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

print(*ans)

Solution (Python):
from collections import defaultdict,deque
from sys import stdin,setrecursionlimit
import heapq,bisect,math,itertools,string,queue,datetime,copy
setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, stdin.readline().split()))

N = int(input())
Als = inpl()
sm = 0
for item in Als:
    sm = sm^item

anls = []
for item2 in Als:
    anls.append(str(sm^item2))

print(' '.join(anls))

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

totalH = 0
for a in listA:
    totalH = a ^ totalH

answerL = []
for a in listA:
    ans = a ^ totalH
    answerL.append(str(ans))

print(" ".join(answerL))

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

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
x = [0 for _ in range(31)]
for ai in a:
  i = 0
  while ai > 0:
    if ai%2 == 1:
      x[i] += 1
    ai = ai//2
    i += 1
for i in range(31):
  x[i] = x[i]%2
for ai in a:
  s = 0
  for i in range(31):
    if ai%2 == 1:
      if x[i] == 0:
        s += 2**i
    else:
      if x[i] == 1:
        s += 2**i
    ai = ai//2
  print(s)

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

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(x^i)
print(*ans)

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

xor_a=0
for i in range(len(a)):
    xor_a=xor_a^a[i]


b = [xor_a^a[i] for i in range(len(a))]
print(" ".join(map(str, b)))

Solution (Python):
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())
a=lnii()

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

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

print(*ans)

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

Solution (Python):
n = int(input())
A = list(map(int, input().split()))
table = [0] * 32
for a in A:
    for i in range(32):
        if a>>i & 1:
            table[31-i] += 1
arr = [0] * 32
ans = 0
for i, v in enumerate(table):
    if v % 2 == 1:
        arr[i] = 1
for i, a in enumerate(arr):
    ans += a * (2**(31-i))
for a in A:
    print(ans^a, end=" ")

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

Solution (Python):
import collections,sys
input=sys.stdin.readline
n=int(input())
l=list(map(int,input().split()))
z=len(format(max(l),'b'))
x=[0]*z
for i in range(n):
  l[i]=format(l[i],'b')
  l[i]='0'*(z-len(l[i]))+l[i]
  for j,y in enumerate(l[i]):
    if y=='0':
      x[j]+=1
for j in range(z):
  x[j]=str(x[j]%2)
x=int(''.join(x),2)
for i in range(n):
  l[i]=int(l[i],2)
  l[i]=l[i]^x
print(*l)

Solution (Python):
n = int(input())
arr = [int(x) for x in input().split()]
ans = []
xor = 0
for i, x in enumerate(arr):
    xor = xor ^ x
for i, x in enumerate(arr):
    temp = xor ^ x

    ans.append(temp)
for x in ans:
    print(x, end=" ")

Solution (Python):
def two(x):
    lis=[]
    for i in range(50):
        lis.append(x%2)
        x=x//2
    return lis

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

tl=[]
for i in range(50):
    tl.append(2**i)

lis=[0 for i in range(50)]

for ai in a:
    twoi=two(ai)
    for j in range(50):
        lis[j]=(lis[j]+twoi[j])%2

ans=[]
for ai in a:
    ansi=0
    twoi=two(ai)
    for j in range(50):
        if twoi[j]!=lis[j]:
            ansi+=tl[j]
    ans.append(ansi)

print(*ans)

Solution (Python):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
 
def do():
    n=INT()
    a=LIST()
    temp=0
    for i in a:
        temp=temp^i
    
    b=[0]*n
    for i in range(n):
        b[i]=a[i]^temp
    print(*b)
    
        
    
if __name__ == '__main__':
    do()

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

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

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10**6)


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


if __name__ == '__main__':
    main(sys.stdin.readline, print)

Solution (Python):

n = int(input())
a = list(map(int, input().split()))
result = [0]*n
xor_sum = 0
for ai in a:
    xor_sum = xor_sum ^ ai
    

for i in range(n):
    result[i] = str(xor_sum ^ a[i])
    

print(" ".join(result))

Solution (Python):

import sys


def solve(N: int, a: "List[int]"):
    from functools import reduce
    assert N % 2 == 0
    b = reduce(lambda a, b: a ^ b, a)
    return [aa ^ b for aa in a]


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)]  
    print(*solve(N, a))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    
    main()

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

Solution (Python):

import sys


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

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

    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
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    n=int(input())
    A=list(map(int,input().split()))
    ans=0
    for i in A:
        ans^=i
    
    for i in A:
        ans2=ans
        print(ans2^i, end=' ')
    
resolve()

Solution (Python):
import sys
imput = sys.stdin.readline
N = int(input())
A = list(map(int,input().split()))
ans = A[0]
for i in A[1:]:
    ans ^=i
for i in A:
    print(ans^i)

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

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

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

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

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

for a in A:
    print(S ^ a)

Solution (Python):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    t = 0
    for v in a:
        t = (t ^ v)
    for v in a:
        print(v ^ t, end=" ")

if __name__ == "__main__":
    main()

Solution (Python):
import sys
from functools import reduce
read = sys.stdin.read

n, *lst = map(int, read().split())
lst_xor = reduce(lambda x, y: x ^ y, lst)
print(*[lst_xor ^ i for i in lst])