AtCoder Beginner Contest 171 - Red Scarf

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-----
4
20 11 9 24

-----Sample Output-----
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.

Source: atcoder | Difficulty: MEDIUM


Solutions:
N = int(input())
(*A,) = map(int, input().split())
total = 0
for i in range(N):
	total ^= A[i]
print(*[total ^ A[i] for i in range(N)])


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


N = int(input())
a = list(map(int, input().split()))
B = a[0]
for i in range(1, N):
	B ^= a[i]
print(' '.join([str(B ^ i) for i in a]))


N = int(input())
a = list(map(int, input().split()))
x = 0
for r in a:
	x ^= r
print(' '.join([str(x ^ r) for r in a]))


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


N = int(input())
a = list(map(int, input().split()))
s = a[0]
for i in a[1:]:
	s = s ^ i
for i in a:
	print(s ^ i)


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


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


from functools import reduce
from operator import xor
(N, *A) = map(int, open(0).read().split())
B = reduce(xor, A)
print(*map(lambda a: B ^ a, A))


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)


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


(_, *a) = open(0).read().split()
x = eval('^'.join(a))
for i in a:
	print(x ^ int(i), end=' ')


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


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


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


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


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


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


import sys
from collections import deque, defaultdict, Counter
from itertools import accumulate, product, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush
from math import ceil, floor, sqrt, gcd, inf
from copy import deepcopy
import numpy as np
import scipy as sp
INF = inf
MOD = 1000000007
n = int(input())
A = [int(i) for i in input().split()]
tmp = A[0]
res = 0
for i in range(1, n):
	tmp ^= A[i]
res = [tmp ^ A[i] for i in range(n)]
res = ' '.join([str(r) for r in res])
print(res)


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


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)


def main():
	N = int(input())
	a = list(map(int, input().split()))
	total = 0
	for other in a:
		total ^= other
	print(*[other ^ total for other in a])

def __starting_point():
	main()
__starting_point()


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


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


n = int(input())
a = list(map(int, input().split()))
x = 0
for i in a:
	x ^= i
print(*list(map(lambda y: x ^ y, a)))


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


N = int(input())
a = [int(s) for s in input().split()]
b = a[0]
c = []
for i in range(1, N):
	b = b ^ a[i]
for i in range(N):
	c.append(str(b ^ a[i]))
d = ' '.join(c)
print(d)


n = int(input())
nums = [int(x) for x in input().split()]
s = 0
for i in nums:
	s = s ^ i
for i in nums:
	print(s ^ i, end=' ')


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


n = int(input())
ar = list(map(int, input().split()))
x = 0
for i in ar:
	x ^= i
for i in ar:
	print(x ^ i, end=' ')


n = int(input())
A = list(map(int, input().split()))
X = A[0]
for a in A[1:]:
	X = X ^ a
for i in range(n):
	A[i] = str(X ^ A[i])
print(' '.join(A))


N = int(input())
A = list(map(int, input().split()))
b = 0
C = []
for a in A:
	b ^= a
for a in A:
	C.append(a ^ b)
print(*C)


input()
A = [*map(int, input().split())]
s = 0
for a in A:
	s ^= a
print(*[a ^ s for a in A])


import math
ini = lambda : int(input())
inm = lambda : map(int, input().split())
inl = lambda : list(map(int, input().split()))
gcd = lambda x, y: gcd(y, x % y) if x % y else y

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)
	divisors.sort()
	return divisors

class UnionFind:

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

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

	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return
		if self.parents[x] > self.parents[y]:
			(x, y) = (y, x)
		self.parents[x] += self.parents[y]
		self.parents[y] = x

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

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

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

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

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

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

	def __str__(self):
		return '\n'.join(('{}: {}'.format(r, self.members(r)) for r in self.roots()))
mod = 10 ** 9 + 7
n = ini()
a = inl()
A = 0
for x in a:
	A ^= x
for x in a:
	print(A ^ x, end=' ')


n = int(input())
r = list(map(int, input().split()))
s = 0
for u in r:
	s ^= u
t = [x ^ s for x in r]
print(*t)


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


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)


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)


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)


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


import math
from math import gcd, pi, sqrt
INF = float('inf')
MOD = 10 ** 9 + 7
import sys
sys.setrecursionlimit(10 ** 6)
import itertools
import bisect
from collections import Counter, deque

def i_input():
	return int(input())

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

def i_list():
	return list(i_map())

def i_row(N):
	return [i_input() for _ in range(N)]

def i_row_list(N):
	return [i_list() for _ in range(N)]

def s_input():
	return input()

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

def s_list():
	return list(s_map())

def s_row(N):
	return [s_input for _ in range(N)]

def s_row_str(N):
	return [s_list() for _ in range(N)]

def s_row_list(N):
	return [list(s_input()) for _ in range(N)]

def main():
	N = i_input()
	A = i_list()
	X = A[0]
	for i in range(1, N):
		X ^= A[i]
	for i in range(N):
		print(X ^ A[i], end=' ')

def __starting_point():
	main()
__starting_point()


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)


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


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


n = int(input())
arr = list(map(int, input().split()))
acc = 0
for e in arr:
	acc ^= e
print(*[acc ^ e for e in arr])


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


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


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


n = input()
a = input()
s = eval(a.replace(' ', '^'))
print(*[s ^ i for i in map(int, a.split())])


(n, *a) = map(int, open(0).read().split())
all = 0
for i in a:
	all ^= i
print(*[all ^ i for i in a])


N = int(input())
A = [int(i) for i in input().split()]
s = 0
for v in A:
	s ^= v
print(' '.join([str(s ^ v) for v in A]))


n = int(input())
ls = list(map(int, input().split()))
x = 0
for i in ls:
	x ^= i
for j in ls:
	print(x ^ j, end=' ')


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


N = int(input())
A = [int(i) for i in input().split()]
temp = 0
for i in A:
	temp ^= i
for i in A:
	print(temp ^ i)


def e_red_scarf():
	from functools import reduce
	N = int(input())
	A = [int(i) for i in input().split()]
	total = reduce(lambda x, y: x ^ y, A)
	ans = [a ^ total for a in A]
	return ' '.join(map(str, ans))
print(e_red_scarf())


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


n = int(input())
A = list(map(int, input().split()))
x = 0
for a in A:
	x ^= a
ANS = [x ^ a for a in A]
print(*ANS)


n = int(input())
a = [int(i) for i in input().split()]
s = 0
for i in a:
	s ^= i
for i in a:
	print(s ^ i, end=' ')


(N, *D) = map(int, open(0).read().split())
ALL = 0
for d in D:
	ALL ^= d
D = map(lambda x: x ^ ALL, D)
print(*D, sep=' ')


N = int(input())
A = [int(x) for x in input().split()]
allxor = A[0]
for j in range(1, N):
	allxor ^= A[j]
ans = [0] * N
for i in range(N):
	ans[i] = allxor ^ A[i]
print(*ans, sep=' ')


N = int(input())
a = list(map(int, input().split()))
t = 0
for e in a:
	t = t ^ e
print(*[e ^ t for e in a])


N = int(input())
A = list(map(int, input().split()))
sum_xor = A[0]
for i in range(1, N):
	sum_xor ^= A[i]
for j in range(N):
	print(sum_xor ^ A[j], end=' ')


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


n = int(input())
l = list(map(int, input().split()))
p = 0
for i in l:
	p ^= i
ans = []
for i in l:
	ans.append(p ^ i)
print(*ans)


from functools import reduce
from operator import xor
N = int(input())
(*A,) = map(int, input().split())
Z = reduce(xor, A)
print(*[Z ^ a for a in A])


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


import sys

def input():
	return sys.stdin.readline().rstrip()

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

def __starting_point():
	main()
__starting_point()


N = int(input())
A = [int(x) for x in input().split()]
S = 0
for x in A:
	S ^= x
print(*[S ^ x for x in A])


n = int(input())
a = [int(_) for _ in input().split()]
A = 0
for i in a:
	A ^= i
for i in a:
	print(A ^ i, end=' ')
print()


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=' ')


N = int(input())
A = [int(a) for a in input().split()]
total = 0
for a in A:
	total ^= a
for a in A:
	print(total ^ a, end=' ')


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


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


import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
total = 0
for i in range(n):
	if i == 0:
		total = a[i]
	else:
		total = total ^ a[i]
b = []
for i in range(n):
	b.append(str(a[i] ^ total))
print(' '.join(b))


n = int(input())
lis = list(map(int, input().split()))
m = 0
for a in lis:
	m = m ^ a
for a in lis:
	print(m ^ a, end=' ')


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


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


import sys
from itertools import chain

def solve(N: int, A: 'List[int]'):
	total = 0
	for a in A:
		total ^= a
	return [total ^ a for a in A]

def main():
	tokens = chain(*(line.split() for line in sys.stdin))
	N = int(next(tokens))
	A = [int(next(tokens)) for _ in range(N)]
	ans = solve(N, A)
	print(' '.join([str(a) for a in ans]))

def __starting_point():
	main()
__starting_point()


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


import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
xor = a[0]
for i in range(1, N):
	xor ^= a[i]
ans = []
for i in range(N):
	ans.append(xor ^ a[i])
print(' '.join(map(str, ans)))


n = int(input())
a = [int(i) for i in input().split()]
b = 0
for i in a:
	b ^= i
ans = [i ^ b for i in a]
print(*ans)


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


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


(_, *A) = map(int, open((s := 0)).read().split())
for a in A:
	s ^= a
print(*[a ^ s for a in A])


import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
all = 0
for a_i in A:
	all ^= a_i
ans = []
for a_i in A:
	ans.append(all ^ a_i)
print(*ans)


n = int(input())
a = [int(x) for x in input().split()]
s = 0
for i in range(n):
	s = s ^ a[i]
for i in range(n):
	x = s ^ a[i]
	print(x, end='')
	if i == n - 1:
		print('')
	else:
		print(' ', end='')


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


n = int(input())
l = list(map(int, input().split()))
x = l[0]
xx = []
for i in l[1:]:
	x ^= i
for i in l:
	xx.append(x ^ i)
print(*xx)


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


n = int(input())
a = list(map(int, input().split()))
b = a[0]
for v in a[1:]:
	b ^= v
print(*map(lambda x: x ^ b, a))


input()
a = [int(i) for i in input().split()]
b = 0
for i in a:
	b ^= i
print(*[i ^ b for i in a])


n = int(input())
A = list(map(int, input().split()))
x = 0
for a in A:
	x ^= a
L = []
for a in A:
	L.append(x ^ a)
print(*L)


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


N = int(input())
a = list(map(int, input().split()))
sum = 0
for i in a:
	sum = i ^ sum
for i in a:
	print(sum ^ i, end=' ')


n = int(input())
(*A,) = map(int, input().split())
s = 0
for a in A:
	s = s ^ a
X = [s ^ a for a in A]
print(*X)


(n, *a) = map(int, open(0).read().split())
b = 0
for i in a:
	b ^= i
c = [b ^ i for i in a]
print(*c)


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


N = int(input())
a = 0
l = []
for i in map(int, input().split()):
	l.append(i)
	a = a ^ i
for i in l:
	print(a ^ i)


n = int(input())
a_ls = list(map(int, input().split()))
s_ls = [0] * n
Sum = 0
for i in range(n):
	Sum = Sum ^ a_ls[i]
for i in range(n):
	s_ls[i] = Sum ^ a_ls[i]
print(*s_ls)


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=' ')


N = int(input())
A = [int(x) for x in input().split()]
t = 0
for i in range(N):
	t ^= A[i]
print(*[A[i] ^ t for i in range(N)])


N = int(input())
A = list(map(int, input().split()))
temp = A[0]
for a in A[1:]:
	temp ^= a
print(*[a ^ temp for a in A])


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


def solve(N, As):
	all_xor = 0
	for A in As:
		all_xor ^= A
	ans = ''
	for A in As:
		ans += str(A ^ all_xor) + ' '
	print(ans[:-1])

def __starting_point():
	N = int(input())
	As = [int(i) for i in input().split()]
	solve(N, As)
__starting_point()


n = int(input())
l = list(map(int, input().split()))
s = 0
for i in l:
	s ^= i
for i in l:
	print(s ^ i, end=' ')


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


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


n = int(input())
a = list(map(int, input().split()))
s = a[0]
for i in a[1:]:
	s ^= i
for i in a:
	print(s ^ i, end=' ')


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

def main():
	n = int(input())
	input_a = list(map(int, input().split()))
	a = deque(input_a)
	while len(a) != 1:
		x = a.popleft()
		y = a.popleft()
		z = x ^ y
		a.append(z)
	sum = a.popleft()
	ans = []
	for i in input_a:
		x = i ^ sum
		ans.append(x)
	for i in ans:
		print(i, end=' ')
main()


n = int(input())
a = [int(i) for i in input().split()]
s = a[0]
for i in a[1:]:
	s ^= i
print(*[s ^ i for i in a])


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, bisect
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
import sys
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
stdin = sys.stdin
ni = lambda : int(ns())
nf = lambda : float(ns())
na = lambda : list(map(int, stdin.readline().split()))
nb = lambda : list(map(float, stdin.readline().split()))
ns = lambda : stdin.readline().rstrip()
N = ni()
a = na()
num = a[0]
for i in range(1, N):
	num ^= a[i]
ans = []
for i in range(N):
	ans.append(num ^ a[i])
print(*ans)


n = int(input())
a = [int(i) for i in input().split()]
axor = 0
for i in a:
	axor = axor ^ i
for i in a:
	print(axor ^ i)


def main():
	N = int(input())
	A = [int(a) for a in input().split()]
	xor_all = A[0]
	for i in range(1, N):
		xor_all ^= A[i]
	for i in range(N):
		if i != N - 1:
			print(A[i] ^ xor_all, end=' ')
		else:
			print(A[i] ^ xor_all)

def __starting_point():
	main()
__starting_point()


n = int(input())
lis = list(map(int, input().split()))
t = lis[0]
for i in range(1, n):
	t ^= lis[i]
ans = [0] * n
for (i, j) in enumerate(lis):
	ans[i] = t ^ j
print(*ans)


t = int(input())
n = list(map(int, input().split()))
xor = 0
for x in n:
	xor ^= x
for x in n:
	print(x ^ xor, end=' ')


n = int(input())
a = [int(x) for x in input().split()]
s = 0
for c in a:
	s = s ^ c
b = [str(s ^ x) for x in a]
print(' '.join(b))


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


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


from functools import reduce
N = int(input())
A = list(map(int, input().split()))
B = reduce(lambda x, y: x ^ y, A)
ans = []
for a in A:
	ans.append(B ^ a)
print(*ans)


n = int(input())
a = [int(i) for i in input().split()]
s = 0
for v in a:
	s ^= v
b = [s ^ v for v in a]
print(*b)


N = int(input())
As = list(map(int, input().split()))
array = []
B = 0
for i in range(N):
	B ^= As[i]
ans_array = []
for i in range(N):
	ans_array.append(B ^ As[i])
print(*ans_array)


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)


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


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


import sys
input = sys.stdin.readline

def main():
	N = int(input())
	a = list(map(int, input().split()))
	s = 0
	for i in a:
		s ^= i
	for i in a:
		ans = s ^ i
		print(ans, sep=' ', end=' ')
main()


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


n = int(input())
a = [int(x) for x in input().split()]
tot = 0
for i in range(n):
	tot ^= a[i]
for i in range(n):
	a[i] ^= tot
print(*a)


n = int(input())
a = list(map(int, input().split()))
s = a[0]
for i in a[1:]:
	s ^= i
ans = ''
for i in a:
	x = s ^ i
	ans += str(x)
	ans += ' '
print(ans[:-1])


N = int(input())
A = list(map(int, input().split()))
X = A[0]
for i in range(1, N):
	X ^= A[i]
for i in range(N):
	print(X ^ A[i], end=' ')


N = int(input())
a = [int(x) for x in input().split()]
X = 0
for aa in a:
	X ^= aa
for aa in a:
	print(X ^ aa)


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


n = int(input())
A = list(map(int, input().split()))
s = 0
for a in A:
	s ^= a
for a in A:
	print(s ^ a, '', end='')


N = int(input())
A = [int(i) for i in input().split()]
total = 0
for a in A:
	total ^= a
print(*[total ^ a for a in A])


N = int(input())
A = [int(a) for a in input().split()]
s = 0
for a in A:
	s ^= a
print(*[a ^ s for a in A])


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)


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


n = int(input())
a = [int(x) for x in input().split()]
s = 0
for i in a:
	s ^= i
print(*[x ^ s for x in a])


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


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


N = int(input())
Alist = list(map(int, input().split()))
XorPro = 0
for i in Alist:
	XorPro = XorPro ^ i
Answer = []
for i in Alist:
	Answer.append(XorPro ^ i)
print(*Answer)


n = int(input())
a = list(map(int, input().split()))
b = []
s = 0
for aa in a:
	s ^= aa
for aa in a:
	b.append(s ^ aa)
print(*b)


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


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


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


n = int(input())
a = list(map(int, input().split()))
b = 0
for i in a:
	b ^= i
print(' '.join(map(lambda x: str(b ^ x), a)))


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


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


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

def __starting_point():
	main()
__starting_point()


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


def main():
	n = int(input())
	a = list(map(int, input().split(' ')))
	all = 0
	for ele in a:
		all ^= ele
	for ele in a:
		print(all ^ ele, end=' ')
	print()

def __starting_point():
	main()
__starting_point()


def main():
	import sys
	pin = sys.stdin.readline
	pout = sys.stdout.write
	perr = sys.stderr.write
	N = int(pin())
	a = list(map(int, pin().split()))
	s = 0
	for i in a:
		s = s ^ i
	ansl = []
	for j in a:
		ansl.append(str(s ^ j))
	ans = ' '.join(ansl)
	print(ans)
	return
main()


import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
x = 0
for item in a:
	x ^= item
ans = []
for item in a:
	ans.append(x ^ item)
ans = map(str, ans)
print(' '.join(ans))


(n, *a) = map(int, open(0).read().split())
xor = 0
for x in a:
	xor ^= x
ans = []
for y in a:
	ans += (y ^ xor,)
print(*ans)


N = int(input())
A = list(map(int, input().split()))
all = 0
for a in A:
	all ^= a
for a in A:
	print(all ^ a, end=' ')


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


n = int(input())
A = list(map(int, input().split()))
aa = 0
for i in A:
	aa ^= i
ans = [0] * n
for i in range(n):
	ans[i] = aa ^ A[i]
print(' '.join(map(str, ans)))


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


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


n = int(input())
a = list(map(int, input().split()))
from functools import reduce
from operator import xor
xorsum = reduce(xor, a)
print(*[x ^ xorsum for x in a])


import numpy as np
from numpy import int64
f = open(0)
N = int(f.readline())
a = np.fromstring(f.readline(), dtype=int64, sep=' ')
z = np.bitwise_xor.reduce(a)
ans = np.bitwise_xor(a, z)
print(*ans.tolist())


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


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


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=' ')


n = int(input())
A = list(map(int, input().split()))
x = A[0]
for a in A[1:]:
	x = x ^ a
for a in A:
	print(a ^ x, end=' ')


from functools import reduce
from operator import xor
N = int(input())
A = list(map(int, input().split()))
XorA = reduce(xor, A)
B = []
for a in A:
	B.append(XorA ^ a)
print(*B)


def solve():
	import sys
	N = int(sys.stdin.readline())
	As = list(map(int, sys.stdin.readline().split()))
	S = 0
	for a in As:
		S ^= a
	anss = []
	for i in range(N):
		anss.append(str(S ^ As[i]))
	ans = ' '.join(anss)
	print(ans)

def __starting_point():
	solve()
__starting_point()


n = int(input())
a = list(map(int, input().split()))
k = 0
for i in range(0, n - 1, 2):
	k = k ^ a[i] ^ a[i + 1]
for i in range(n):
	print(k ^ a[i], end=' ')


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)


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


N = int(input())
array = [int(x) for x in input().split()]
XOR = 0
for i in array:
	XOR = XOR ^ i
print(*[XOR ^ x for x in array])


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


n = int(input())
A = list(map(int, input().split()))
X = 0
for e in A:
	X = X ^ e
for e in A:
	print(X ^ e, end=' ')


n = int(input())
a = list(map(int, input().split()))
S = a[0]
for v in a[1:]:
	S = S ^ v
for v in a:
	print(S ^ v)


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)


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


N = int(input())
lst = list(map(int, input().split()))
sx = lst[0]
for i in range(1, N):
	sx = sx ^ lst[i]
print(*[i ^ sx for i in lst])


n = int(input())
a = [int(i) for i in input().split()]
x = 0
for i in a:
	x ^= i
print(*[x ^ i for i in a], sep=' ')


n = int(input())
A = [*map(int, input().split())]
all_xor = 0
for a in A:
	all_xor ^= a
print(*[all_xor ^ a for a in A])


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


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):
	ans.append(b ^ a[i])
print(' '.join(list(map(str, ans))))


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


n = int(input())
a = [int(j) for j in input().split()]
x = 0
for i in a:
	x ^= i
print(*[x ^ i for i in a])


n = int(input())
aa = list(map(int, input().split()))
tot = 0
for a in aa:
	tot ^= a
print(*[tot ^ a for a in aa])


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)