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, *A = map(int, open(0).read().split())
s = 0
for a in A:
    s ^= a
B = []
for a in A:
    B.append(s ^ a)
print(*B)

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

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

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

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

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

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

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

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

print()

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
def f(x):
  c=[x[i-1]^x[i]for i in range(1,n)]
  k=[x[1:].count(1)%2]
  for i in c:
    k.append(k[-1]^i)
  return k
for i in range(31):
  t=1<<i
  x=[]
  for j in a:
    if t&j:x.append(1)
    else:x.append(0)
  m=f(x)
  for j in range(n):ans[j]+=t*m[j]
print(*ans)

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

Solution (Python):
import sys
import math
def II():
	return int(sys.stdin.readline())

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

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

def SI():
	return sys.stdin.readline().strip()
n = II()
a = LI()
s = a[0]
for i in a[1:]:
	s^=i
ans = []
for i in range(n):
	ans.append(s^a[i])
print(*ans)

Solution (Python):
n = int(input())
A = list(int(x) for x in input().split())
tmp = 0
for a in A:
    tmp ^= a

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

print(" ".join(ANS))

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

Solution (Python):
from functools import reduce

def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    b = reduce(lambda x,y: x^y, a)
    print(*list(map(lambda x: a[x]^b, range(n))))

if __name__ == "__main__":
    resolve()

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

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

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

allXOR = 0
for a in As:
    allXOR ^= a

ans = []
for a in As:
    ans.append(allXOR ^ a)
print(' '.join(map(str, ans)))

Solution (Python):

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

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')
AZ = "abcdefghijklmnopqrstuvwxyz"






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


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 make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count




N = I()
A = IL()

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

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

Solution (Python):
import math
import time
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
n=int(input())
a=list(map(int,stdin.readline().split()))
total=0
for i in a:
    total=total^i 
for i in range(n):
    a[i]=total^a[i]
print(*a)

Solution (Python):
import sys

n, *aaa = map(int, sys.stdin.buffer.read().split())
all_xor = 0
for a in aaa:
    all_xor ^= a

buf = []

for a in aaa:
    buf.append(all_xor ^ a)

print(*buf)

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

al = 0

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

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

print(*ans)

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

kotae = []

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

for i in range(n):
    kotae.append(str(total ^ a[i]))


kotae = " ".join(kotae)
print(kotae)

Solution (Python):

from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)


def main():
    N = I()
    A = LI()

    sumxor = 0
    for ai in A:
        sumxor ^= ai

    for ai in A:
        print(sumxor ^ ai, end=" ")


main()

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

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

b = []
for i in range(N - 1) :
  b.append(a[i] ^ a[(i + 1) % N])

x = 0
for i in range(0, N - 1, 2) :
  x ^= b[i]

ret = [a[-1] ^ x]
for c in b[::-1] :
  ret.append(c ^ ret[-1])

ret = ret[::-1]
print(*ret)

Solution (Python):
from sys import stdin,stdout
input = stdin.readline
print = stdout.write
from functools import reduce
n = int(input())
a = list(map(int,input().split()))
xor = reduce(lambda x,y: x^y,a)
for i in a:
    print(str(xor^i)+" ")

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

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

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


resolve()

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

Solution (Python):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    xorA = 0
    for a in A:
        xorA ^= a
    ans = [xorA ^ a for a in A]
    print(*ans, sep=' ')

if __name__ == '__main__':
    main()

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

N=int(input())
a=list(map(int,input().split()))
s=0
for x in a:
    s^=x
for x in a:
    print(s^x)

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

def xor(x, y):
  return x^y

from functools import reduce
s = reduce(xor, a)
ans = []
for i in range(n):
  ans.append(str(xor(s, a[i])))
print(' '.join(ans))

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

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

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()))
S=0
for a in A:
    S^=a
for a in A:
    print(S^a)

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

Solution (Python):
import itertools, operator
N = int(input())
A = [int(_) for _ in input().split()]
S = list(itertools.accumulate(A, func=operator.xor))[-1]
print(*(S ^ a for a in A), sep=' ')

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

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

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

Solution (Python):
from functools import reduce
N = int(input())
A = [int(i) for i in input().split()]
B = reduce(lambda x,y: x^y, A)
print(" ".join(map(str, [A[i]^B for i in range(N)])))

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

Solution (Python):



from math import *
from copy import *                    
from heapq import *                    
from string import *                
from random import *                
from bisect import *                
from sys import stdin                
from sys import maxsize                
from operator import *                
from itertools import *                
from decimal import Decimal         
from collections import Counter        
from collections import defaultdict 

'''

'''

def solve(l):
    n = len(l)
    xor = 0
    for i in l:
        xor ^= i
    ans = []
    for i in l:
        ans.append(xor^i)
    return ans
    

N = int(stdin.readline())
l = list(map(int, stdin.readline().rstrip().split()))
ans = solve(l)
print(*ans)

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

for i in a:
    for j in range(32):
        if i >> j & 1:
            l[j] += 1

ans = [0]*n

for i in range(32):
    if l[i]%2 == 0:
        for j in range(n):
            if a[j]>>i & 1:
                ans[j] += 1<<i
    else:
        for j in range(n):
            if not a[j] >> i & 1:
                ans[j] += 1<<i
print(*ans)

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

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

ans = [str(num ^ a) for a in As]

print(" ".join(ans))

Solution (Python):
import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
A=[int(i) for i in input().split()]
tot=0
for a in A:
  tot^=a
T=[0]*30
for i in range(30):
  if tot&(1<<i):
    T[i]=1

Ans=[0]*n
for i in range(n):
  cur=0
  for j in range(30):
    if A[i]&(1<<j)>0 and T[j]==0:
      cur+=2**j
    elif A[i]&(1<<j)==0 and T[j]==1:
      cur+=2**j
  Ans[i]=cur
print(*Ans)

Solution (Python):

import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub, xor


import sys


buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):
    S = reduce(xor, A, 0)
    ans = []
    for a in A:
        ans.append(S ^ a)
    return ans


def main():
    N = read_int()
    A = read_int_n()
    print(*slv(N, A))


if __name__ == '__main__':
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

from collections import Counter
N = int(input())
As = list(mapint())

cum = 0
for a in As:
    cum^=a
A = []
for a in As:
    ans = cum^a
    A.append(str(ans))
print(' '.join(A))

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

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

Solution (Python):

from __future__ import division, print_function

import os
import sys
from operator import xor
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    n = int(input())
    a = [int(ai) for ai in input().split()]

    x = reduce(xor, a)

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




BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")



if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
*A, = map(int, input().split())
x = 0
for a in A:
    x ^= a
for a in A:
    print(x^a, end=" ")

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

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

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

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

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

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

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

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

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

print(*ans)

Solution (Python):



















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

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

result = map(lambda x: str(x ^ s), a)
print(" ".join(result))

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

al=0
for ele in A:
    al=al^ele

for ele in A:
    print(al^ele)

Solution (Python):
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    N = int(input())
    A = list(map(int,input().split()))
    tot = 0
    for a in A:
        tot ^= a
    
    ans = []
    for a in A:
        ans.append(tot^a)
    print(*ans)
if __name__ == '__main__':
    main()

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

xor_total = 0
for sunuke in a:
    xor_total = xor_total ^ sunuke

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

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

Solution (Python):
import sys

import math
import collections

import bisect
import itertools
import fractions

import copy

import decimal

import queue



sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7


ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))



def main():
    n = ni()
    a = na()

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

    ans = []
    for ai in a:
        ans.append(total_xor ^ ai)

    print(*ans, sep=" ")


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    A = [int(x) for x in input().strip().split()]
    X = 0
    for a in A:
        X ^= a
    B = [0] * N
    for i, a in enumerate(A):
        B[i] = X ^ a
    print(*B)

if __name__ == '__main__':
    main()

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

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

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

print(*ans)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
from math import floor, sqrt, factorial, hypot, log  
from heapq import heappop, heappush, heappushpop
from collections import Counter, defaultdict, deque
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint


def ceil(a, b): return (a + b - 1) // b


inf = float('inf')
mod = 10 ** 9 + 7


def pprint(*A):
    for a in A:     print(*a, sep='\n')


def INT_(n): return int(n) - 1


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


def MF(): return map(float, input().split())


def MI_(): return map(INT_, input().split())


def LI(): return list(MI())


def LI_(): return [int(x) - 1 for x in input().split()]


def LF(): return list(MF())


def LIN(n: int): return [I() for _ in range(n)]


def LLIN(n: int): return [LI() for _ in range(n)]


def LLIN_(n: int): return [LI_() for _ in range(n)]


def LLI(): return [list(map(int, l.split())) for l in input()]


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


def F(): return float(input())


def ST(): return input().replace('\n', '')


def main():
    N = I()
    a = LI()
    ans = a[0]
    for i in range(1,N):
        ans ^= a[i]
    ansl = []
    for i in a:
        ansl.append(i^ans)
    print(" ".join(map(str, ansl)))


if __name__ == '__main__':
    main()

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

Solution (Python):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): 
	return list(map(int,input().split()))
def m(): 
	return map(int,input().split())
def onem(): 
	return int(input())
def s(x): 
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): 
	return " ".join(map(str,x))
def max2(x): 
	return max(map(max,x))
def In(x,a): 
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

n = onem()

a = l()

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

Solution (Python):
import collections
FAST_IO = 1
if FAST_IO:
    import io, sys, atexit
    rr = iter(sys.stdin.read().splitlines()).next
    sys.stdout = _OUTPUT_BUFFER = io.BytesIO()
    @atexit.register
    def write():
        sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
    rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())
 
    
    

    
N = rri()
arr = rrm()
a = arr[0]
for i in range(1, N):
    a^=arr[i]
ans = []
for i in range(N):
    ans.append(str(a^arr[i]))
print(" ".join(ans))

Solution (Python):
from collections import Counter, defaultdict


_ = int(input())

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

cnt = 0
for a in lst:
    cnt = cnt^a

res = []
for a in lst:
    res.append(str(cnt^a))

print(" ".join(res))

Solution (Python):

import sys
input = sys.stdin.readline
ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda :int(input())
ip = lambda :[int(w) for w in input().split()]

n = inp()
x = ip()
ans = [0]*n
no = x[0]
for i in range(1,n):
    no = x[i]^no
for i in range(n):
    ans[i] = x[i]^no
print(*ans)

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

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

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

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

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

Solution (Python):
N = int(input())
Ali = list(map(int,input().split()))
s = 0

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

Solution (Python):
import sys

def read_int():
    l = sys.stdin.readline().rstrip('\n').split(' ')
    return int(l[0])

def read_int_list():
    l = sys.stdin.readline().rstrip('\n').split(' ')
    return [int(i) for i in l]

N = read_int()
A = read_int_list()

all_xor = 0                                                                                           

for a in A:                                                                                           
    all_xor ^= a                                                                                      

for a in A:                                                                                           
    print(all_xor ^ a)

Solution (Python):
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
from functools import lru_cache
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 998244353

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    N = int(input())
    A = read_list()

    S = 0
    for a in A:
        S ^= a
    
    res = [S ^ a for a in A]

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


if __name__ == "__main__":
    main()

Solution (Python):


import sys
input=sys.stdin.readline

def main():
    N=int(input())
    A=list(map(int,input().split()))
    
    allX=0
    for a in A:
        allX^=a
    for i in range(N):
        print(allX^A[i] ,end=" ")
    
    
    
if __name__=="__main__":
    main()

Solution (Python):

from sys import stdin
input = stdin.readline
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True 
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n = inn()
a = inl()
x = 0
for i in range(n):
    x ^= a[i]
pad = ''
for i in range(n):
    printn(pad+str(x^a[i]))
    pad = ' '
print('')

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

S = 0

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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
if n % 2 == 0:
    x = 0
    for i in a:
        x ^= i
    for i in a:
        print(x ^ i)
else:
    p = []
    x = 0
    for i in a[:n - 1]:
        x ^= i
    for i in a[:n - 1]:
        p.append(x ^ i)
    x = a[0]
    for i in p[1:]:
        x ^= i
    p.append(x)
    print(*p)

Solution (Python):
n,*l=map(int,open(0).read().split())
x=0
for i in l: x^=i
print(*[x^i for i in l])

Solution (Python):
from functools import reduce

N = int(input())
*a, = map(int, input().split())
v = reduce(lambda x,y:x^y, a)
ans = []
for i in a:
    ans.append(v^i)
print(*ans)

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

Solution (Python):
N=int(input())
l=list(map(int,input().split()))
s=0
for j in range(len(l)):
	s=s^l[j]
for j in range(len(l)):
	print(s^l[j],end=" ")

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

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

print(*[S^A for A in As])