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):
from functools import reduce
from operator import xor
N = int(input())
A = list(map(int, input().split()))

S = reduce(xor, A)
ans = []
for a in A:
  ans.append(S^a)
print(' '.join(map(str, ans)))

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

s = 0
for i in lis:
    s = s^i
lis = list(map(lambda x: str(s^x), lis))
st = ' '.join(lis)
print(st)

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

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

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

print(' '.join([str(s ^ i) for i in a]))

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

line = input().rstrip().split(' ')
a = []
for i in range(n):
    a.append(int(line[i]))

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

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

print()

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


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


def main():
    N = int(input())
    A = inpl()
    lx = 30
    tmp = [0] * lx

    for a in A:
        for i in range(lx):
            if (a >> i) % 2 == 1:
                tmp[i] = (tmp[i] + 1) % 2

    ans = []
    for a in A:
        b = 0
        for i in range(lx):
            if tmp[i] == 0 and (a >> i) % 2 == 1:
                b += 2**i
            elif tmp[i] == 1 and (a >> i) % 2 == 0:
                b += 2**i
        ans.append(b)
    print(*ans)

    return


if __name__ == '__main__':
    main()

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

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

ans=[0]*n
for i in range(n):
    ans[i]=c^a[i]
L=[str(a) for a in ans]
L=" ".join(L)
print(L)

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

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

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

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

Solution (Python):
import numpy as np
import math
import collections
import bisect
import itertools
from collections import Counter

suf_xor_dict = {}
pre_xor_dict = {}


def suf_xor(N, p):
    
    global xor_dict
    if N - len(p) + 1 in suf_xor_dict:
        return suf_xor_dict[N - len(p) + 1]

    if len(p) == 0:
        return 0
    if len(p) == 1:
        suf_xor_dict[N] = p[0]
        return p[0]
    if len(p) == 2:
        suf_xor_dict[N] = p[1]
        suf_xor_dict[N - 1] = p[0] ^ p[1]
        return(p[0] ^ p[1])
    else:
        ret = p[0] ^ suf_xor(N, p[1:])
        suf_xor_dict[N - len(p) + 1] = ret
        return ret


def pre_xor(N, p):
    global pre_xor_dict
    if len(p) in pre_xor_dict:
        return pre_xor_dict[len(p)]

    if len(p) == 0:
        return 0
    if len(p) == 1:
        pre_xor_dict[1] = p[0]
        return p[0]
    if len(p) == 2:
        pre_xor_dict[1] = p[0]
        pre_xor_dict[2] = p[0] ^ p[1]
        return(p[0] ^ p[1])
    else:
        ret = p[-1] ^ pre_xor(N, p[:-1])
        pre_xor_dict[len(p)] = ret
        return ret


def main():
    N = int(input())
    a = list(map(int, input().split()))
    ans = []
    pre_xor_list = [0]
    suf_xor_list = [0]
    for i in range(N):
        pre_xor_list.append(pre_xor_list[i] ^ a[i])
        suf_xor_list.append(suf_xor_list[i] ^ a[N - i - 1])

    pre_xor_list = pre_xor_list[1:]
    suf_xor_list = suf_xor_list[1:]

    for i in range(N):
        ans.append((0 if i - 1 < 0 else pre_xor_list[i - 1]) ^ (0 if i >= N - 1 else suf_xor_list[N - i - 2]))

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


if __name__ == "__main__":
    main()

Solution (Python):

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

for i in range(N):
    B[i]=A[i]^ALL
B=map(str,B)
print(" ".join(B))

Solution (Python):
def main():
    _ = int(input())
    a = tuple(map(int, input().split()))

    res = 0
    for i in a:
        res ^= i
    ans = tuple(res ^ i for i in a)
    print(*ans)


if __name__ == "__main__":
    main()

Solution (Python):

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

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

if __name__ == "__main__":
    resolve()

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

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

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

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

ans = [A^x for x in a]
print(*ans)

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

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

for i in range(n-1):
    s = s ^ li[i+1]

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

print(*ans)

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

Solution (Python):
def main():
    _ = int(input())
    a = tuple(map(int, input().split()))

    res = 0
    for i in a:
        res ^= i
    ans = [res ^ i for i in a]
    print(*ans)


if __name__ == "__main__":
    main()

Solution (Python):


import math



from collections import deque
from collections import Counter




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

Solution (Python):
import sys
input = sys.stdin.readline
from itertools import accumulate
from functools import reduce
from operator import xor, add


def read():
    N = int(input().strip())
    A = list(map(int, input().strip().split()))
    return N, A


def solve(N, A):
    S = reduce(xor, A)
    for a in A:
        print(S ^ a, end=" ")


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

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

    res = 0
    for i in a:
        res ^= i
    ans = [res ^ i for i in a]
    print(*ans)


if __name__ == "__main__":
    main()

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

N = int(input())
AS = list(map(int, input().split()))
total = reduce(xor, AS)
print(*[a ^ total for a in AS])

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

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

B = [0]*N

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

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

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

All = ans[0]^A[0]

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

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

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

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


counter = a[0]^a[1]
answer = []

for i in range(2, N):
    counter = counter^a[i]

for i in range(N):
    answer.append(counter^a[i])

test = map(str, answer)

result = ' '.join(test)
print(result)

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

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

l = []
for i in range(N):
    l.append(x ^ A[i])
print(" ".join(map(str, l)))

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

r = []
for e in a:
  r.append(e^x)
print(*r, sep=" ")

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

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

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

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

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

sumAll = 0

for aa in a:
  sumAll ^= aa

for aa in a:
  print(sumAll^aa, end=" ")

Solution (Python):
import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
from copy import deepcopy




def main():
    N = int(input())
    aa = list(map(int,input().split()))
    S = aa[0]
    for a in aa[1::]:
        S ^= a
    ans = []
    for a in aa:
        ans.append(str(S ^ a))
    print(" ".join(ans))

if __name__ == '__main__':
    main()

Solution (Python):
import sys

readline = sys.stdin.buffer.readline


def solver(A):
    c = 0
    for a in A:
        c ^= a

    ans = [a ^ c for a in A]
    return ans


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

    ans = solver(A)

    print(*ans)


run()

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

S = a[0]

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

ans = []
for i in a:
    ans.append(S^i)
print(*ans, sep="\n")

Solution (Python):
from functools import reduce


def main():
    _ = int(input())
    a = tuple(map(int, input().split()))

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


if __name__ == "__main__":
    main()

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 += [str(a ^ s)]
print(' ' .join(ans))

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

ans = [0 for _ in range(N)]

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

ans = [a ^ c for a in A]

print(*ans)

Solution (Python):

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

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


out=[]
for j in range(N):
    out.append(str(a[j]^zentai))

print(' '.join(out))

Solution (Python):





import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    
    
    n=int(readline())
    arr=list(map(int, readline().rstrip().split()))
    x=0
    for a in arr:
        x=x^a
    
    ans=[]
    for a in arr:
        ans.append(str(x^a))
    print(" ".join(ans))
    
    

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

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

Solution (Python):



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

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

ans2 = ''
for i in range(n):
    ans2 += str(ans^a[i]) + ' '

print(ans2)

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

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

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

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

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

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

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

s = [x^j for j in a]
  
print(*s)

Solution (Python):
N = int(input())
*a, = map(int, input().split())
b = 0
for v in a:
    b ^= v

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

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

a=[ai^x for ai in a]
print(*a)

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

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

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

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

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

lis = []
for a in A:
    Y = X ^ a
    lis.append(Y)
print(*lis)

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

Solution (Python):
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res

N=II()

xorsm=0
AS=LI()
for i in AS:
    xorsm ^= i
res = []
for i in AS:
    res.append("{}".format(xorsm ^ i))

print(" ".join(res))

Solution (Python):
def main():

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

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


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

if __name__ == '__main__':
    main()

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

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

for i in a:
    print(t ^ i)

Solution (Python):


import itertools

n = int(input())
a_l = [list(format(int(x), "030b")) for x in input().split()]

for _d,_tp in enumerate(zip(*a_l)):
    if "1" not in _tp:
        continue
    if "0" not in _tp:
        continue
    else:
        _num = _tp.count("0")
        if _num % 2 == 1:
            for i in range(n):
                if a_l[i][_d] == "0":
                    a_l[i][_d] = "1"
                else:
                    a_l[i][_d] = "0"

print(*[int("".join(x), 2) for x in a_l])

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

b = [S^a for a in A]
print(*b)

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

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

S=0
for A in As:
    S^=A
l=[]
for A in As:
    l.append(S^A)
print(*l)

Solution (Python):
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()
a = readInts()
s = 0
for i in a:
	s = s^i

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

Solution (Python):
import sys




def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


n = I()
a = LI()





A = 0
for elem in a:
    A ^= elem
print(*list(map(lambda elem: elem ^ A, a)))

Solution (Python):
n = int(input())
a = list(map(int, input().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()))

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

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

print(*ans)

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

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

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

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

Solution (Python):
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n = int(input())
    A = list(map(int, input().split()))
    s = 0
    for a in A:
        s = s^a
    B = [s^a for a in A]
    print(*B)



if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
a=list(map(int, input().split()))
i=0
S=[]*N
X=a[0]
for i in range(N-1):
    X^=a[i+1]
for i in range(N):
    S.append(a[i]^X)
print(' '.join(map(str,S)))

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):
N = int(input())
A = list(map(int, input().split()))
temp = 0
for v in A:
    temp ^= v
for i in range(len(A)):
    A[i] ^= temp
print(*A)

Solution (Python):


import re
import math
from collections import defaultdict
from collections import deque
import collections
from fractions import Fraction
import bisect
from queue import PriorityQueue
import itertools
from itertools import accumulate
from copy import deepcopy
from collections import Counter
import heapq
import random
import time
import os
import sys
import datetime
from functools import lru_cache
from functools import reduce
readline=sys.stdin.readline
sys.setrecursionlimit(2000000)
alp="abcdefghijklmnopqrstuvwxyz"
numbers="0123456789"
mod=int(10**9+7)
inf=int(10**19)
class Set():
    def __init__(self,A=[]):
        self.heap=[]
        self.dic=defaultdict(bool)
        self.size=0
        for a in A:self.add(a)
    
    def __str__(self):
        return str(self.heap)
    
    def add(self,x):
        if not self.find(x):
            heapq.heappush(self.heap,x)
            self.dic[x]=True
            self.size+=1

    def remove(self,x):
        if self.find(x):
            self.dic[x]=False
            self.size-=1

    def find(self,x):
        return self.dic[x]
    
    def top(self):
        while self.heap and self.dic[self.heap[0]]==False:
            heapq.heappop(self.heap)
        if self.heap:return self.heap[0]
        else:return None

    def pop(self):
        ret=None
        if self.heap:
            ret=self.top()
            self.remove(ret)
        return ret
class multiset():
    def __init__(self,A=[]):
        self.heap=[]
        self.dic=defaultdict(int)
        self.size=0
        for a in A:self.add(a)
    
    def __str__(self):
        return str(self.heap)
    
    def add(self,x):
        heapq.heappush(self.heap,x)
        self.dic[x]+=1
        self.size+=1

    def remove(self,x):
        if self.dic[x]>0:
            self.dic[x]-=1
            self.size-=1
    
    def count(self,x):
        return self.dic[x]

    def find(self,x):
        return self.dic[x]>0
    
    def top(self):
        while self.heap and self.dic[self.heap[0]]==0:
            heapq.heappop(self.heap)
        if self.heap:return self.heap[0]
        else:return None

    def pop(self):
        ret=None
        if self.heap:
            ret=self.top()
            self.remove(ret)
        return ret
class Edge():
    def __init__(self,x,y,val=1):
        self.x=x
        self.y=y
        self.val=val
class unionfind():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(n)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):
            self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def yn(b):
    if b:print("yes")
    else:print("no")
def Yn(b):
    if b:print("Yes")
    else:print("No")
def YN(b):
    if b:print("YES")
    else:print("NO")
def ispow(a,b):
    now=b
    while now<a:
        now*=b
    return now==a
def getbin(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def getfacs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod_>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def nextcomb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:return num
def getprimes(n):
    if n==0:return []
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    ret=[]
    for a in range(n+1):
        if(A[a]):ret.append(a)
    return ret
def isprime(num):
    if(num<=1):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(bbool,ret1,ret2):
    if bbool:return ret1
    else:return  ret2
def factorize(n):
    b = 2
    ret=defaultdict(int)
    while b * b <= n:
        while n % b == 0:
            n //= b
            ret[b]+=1
        b+=1
    if n > 1:ret[n]+=1
    return ret
def pm(x):
    return x//abs(x)
def inputintlist(): 
    return list(map(int,input().split()))
def inputfloatlist(): 
    return list(map(float,input().split()))
def istanchouzouka(A):
    f=True
    prev=min(A)-1
    for a in A:
        if prev>=a:
            f=False
        prev=a
    return f
def istanchouhigensyou(A):
    f=True
    prev=min(A)-1
    for a in A:
        if prev>a:
            f=False
        prev=a
    return f
def getallsum(A):
    s=sum(A)
    dp=defaultdict(int)
    dp[0]=1
    for a in range(0,len(A)):
        for b in range(s,-1,-1):
            if b-A[a]>=0:
                dp[b]+=dp[b-A[a]]
    return dp
def yuukoutomukou(edges):
    ret=deepcopy(edges)
    for edge in edges:
        if not edge.x==edge.y:
            ret.append(Edge(edge.y,edge.x,edge.val))
    return ret
def dijkstra(edges,V,start):
    mincost=[inf]*V
    G=[[] for a in range(V)]
    for edge in edges:
        G[edge.x].append([edge.val,edge.y])
    Q=PriorityQueue()
    Q.put([0,start])
    while not Q.empty():
        nowcost,nowx=Q.get()
        if mincost[nowx]==inf:
            mincost[nowx]=nowcost
            for cost,y in G[nowx]:
                newcost=nowcost+cost
                Q.put([newcost,y])
    return mincost
def warshallfloyd(edges,V):
    mincost=[[inf for b in range(V)] for a in range(V)]
    for a in range(V):mincost[a][a]=0
    for edge in edges:
        mincost[edge.x][edge.y]=min(mincost[edge.x][edge.y],edge.val)
    for k in range(V):
        for s in range(V):
            for t in range(V):
                if mincost[s][k]==inf or mincost[k][t]==inf:continue
                mincost[s][t]=min(mincost[s][t],mincost[s][k]+mincost[k][t])
    return mincost
def bellemanford(edges,V,start):
    mincost=[inf]*V
    mincost[start]=0
    for _ in range(V):
        for edge in edges:
            if mincost[edge.x]==inf:continue
            mincost[edge.y]=min(mincost[edge.y],mincost[edge.x]+edge.val)
    return mincost
def getmd(x1,y1,x2,y2):
    return abs(x1-x2)+abs(y1-y2)
def geted(x1,y1,x2,y2):
    return math.sqrt((x1-x2)**2+(y1-y2)**2)
class fordfulkerson():
    def __init__(self,edges,V,s,t):
        self.V=V
        self.used=[False]*V
        self.G=[[] for a in range(V)]
        self.s=s
        self.t=t
        for edge in edges:
            self.G[edge.x].append({"x":edge.x,"y":edge.y,"cap":edge.val,"rev":len(self.G[edge.y])})
            self.G[edge.y].append({"x":edge.y,"y":edge.x,"cap":0,"rev":len(self.G[edge.x])-1})
    def dfs(self,v,t,f=inf):
        if v==t:return f
        self.used[v]=True
        for a in range(len(self.G[v])):
            x=self.G[v][a]["x"]
            y=self.G[v][a]["y"]
            cap=self.G[v][a]["cap"]
            rev=self.G[y][self.G[x][a]["rev"]]
            if self.used[y] or cap==0:continue
            f2=self.dfs(y,t,min(f,cap))
            if f2>0:
                self.G[v][a]["cap"]-=f2
                rev["cap"]+=f2
                return f2
        return 0
    def maxflow(self):
        flow=0
        while True:
            self.used=[False]*V
            zouka=self.dfs(self.s,self.t)
            if zouka==0:break
            flow+=zouka
        return flow






n=int(input())
A=list(map(int,input().split()))
B=reduce(lambda a,b:a^b,A)
ans=map(lambda x:x^B,A)
print(*ans)

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

Solution (Python):
def resolve():
    n=int(input())
    a = list(map(int, input().split()))
    mx=len(bin(max(a)))-2
    b = ["0b"]*n
    ch=0
    for j in reversed(range(mx)):
        for i in range(n):
            if (a[i] >> j) & 1:
                ch+=1
        if ch%2==1:
            for i in range(n):
                if (a[i] >> j) & 1:
                        b[i]+="0"
                else:
                    b[i] += "1"
        else:
            for i in range(n):
                if (a[i] >> j) & 1:
                    b[i] += "1"
                else:
                        b[i]+="0"
        ch=0
    for i in range(n):
        b[i]=int(b[i],0)
    c = [str(x) for x in b]
    L = " ".join(c)
    print(L)
resolve()

Solution (Python):
def resolve():
  N = int(input())
  a = [int(x) for x in input().split(" ")]
  S = a[0]
  for i in range(1, N):
    S^=a[i]

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

if __name__ == "__main__":
  resolve()

Solution (Python):
input = raw_input
n = int(input())
ys = map(int, input().split(" "))

yy = ys[0]
for i in range(1, n):
    yy = yy ^ ys[i]
xs = [y^yy for y in ys]
for x in xs:
    print x,
print

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

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

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

all_xor = 0

for a in al:
    all_xor ^= a

ansl = []
for a in al:
    ansl.append(all_xor ^ a)

print(*ansl)

Solution (Python):
N=int(input())
arr = list(map(int,list(input().split())))
ds = set(arr)


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

for i in range(N):
	print(allxor ^ arr[i],end='')
	print(' ',end='')

Solution (Python):
N = int(input())
l = [int(x) for x in input().split()]
s = 0
for i in l:
    s = s^i
for i in l:
    print(s^i,end=" ")

Solution (Python):
import sys

input = sys.stdin.readline


def S():
    return input().rstrip()


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


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


n = I()
A = list(MI())

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

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

print(*ans)

Solution (Python):
def main():
  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],end=' ')
if __name__=='__main__':
  main()

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

main()

Solution (Python):

import sys

sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10 ** 7)


import math







def run():
    N = int(input())
    A = list(map(int, input().split()))
    total = 0
    for a in A:
        total ^= a

    for a in A:
        print(a ^ total)



if __name__ == "__main__":
    run()

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

Solution (Python):
n=int(input())
l=[int(i) for i in input().split()]
xor=0
ans=[]
for i in l:
    xor^=i
for i in l:
    ans.append(xor^i)
print(*ans)

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

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

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

S = a[0]

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

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

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

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

m = list(map(int,input().split()))
xor = 0
for i in m:
    xor ^= i
ans = []
for j in m:
    ans.append(xor ^ j)

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

Solution (Python):
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))



N = I()
a = LI()

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

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

print(*ans)

Solution (Python):
import numpy as np

N = int(input())
a = np.fromstring(input(), sep=" ", dtype=np.int64)
b = np.bitwise_xor.reduce(a)
c = np.bitwise_xor(a, b)
print(*c, sep=" ")