Given a list A having N positive elements. The task to create another list such as i^{th} element is XOR of all elements of  A except A[i].
Example 1:
Input:
A = [2, 1, 5, 9]
Output:
13 14 10 6
Explanation:
At first position 1^5^9 = 13
At second position 2^5^9 = 14
At third position 2^1^9 = 10
At last position 2^1^5 = 6
Example 2:Ã¢â¬â¹
Input:
A = [2, 1]
Output:
1 2
Explanation: 
At first position except first position 
there is only one element = 1
At second position except second position
Ã¢â¬â¹there is only one element = 2
Your Task:  
You don't need to read input or print anything. Your task is to complete the function getXor() which takes a list A and an integer N which is the size of the list A and return the modified list.
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1), Where N is the size of the input array
Constraints:
1<= N <=10000
1<= A[i] <=100000

Difficulty: EASY
Tags: Bit manipulation

Data structures
Skill types: Bit manipulation

Data structures
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1), Where N is the size of the input array

Starter code:
#User function Template for python3
class Solution:
	def getXor(self, A, N):
		# code here

Solutions:
class Solution:

	def getXor(self, A, N):
		xor = 0
		for i in A:
			xor ^= i
		for i in range(N):
			A[i] ^= xor
		return A


class Solution:

	def getXor(self, A, N):
		ans = 0
		for i in A:
			ans ^= i
		a = [0] * N
		for i in range(N):
			a[i] = ans ^ A[i]
		return a


class Solution:

	def getXor(self, A, N):
		t = 0
		for i in A:
			t = t ^ i
		res = []
		for i in A:
			res.append(t ^ i)
		return res


class Solution:

	def getXor(self, A, N):
		xor = 0
		res = []
		for num in A:
			xor = xor ^ num
		res = []
		for i in range(N):
			res.append(xor ^ A[i])
		return res


class Solution:

	def getXor(self, A, N):
		x = 0
		for i in A:
			x ^= i
		l = [x ^ i for i in A]
		return l


class Solution:

	def getXor(self, A, N):
		x = A[0]
		for i in range(1, N):
			x = x ^ A[i]
		return [x ^ q for q in A]


class Solution:

	def getXor(self, A, N):
		xor = 0
		e = []
		for i in A:
			xor ^= i
		k = xor
		for j in A:
			xor = k
			xor ^= j
			e.append(xor)
		return e


class Solution:

	def getXor(self, A, N):
		x = 0
		e = []
		for i in A:
			x ^= i
		k = x
		for i in A:
			x = k
			x ^= i
			e.append(x)
		return e


class Solution:

	def getXor(self, A, N):
		k = 0
		l = []
		for i in A:
			k ^= i
		for i in A:
			l.append(k ^ i)
		return l


class Solution:

	def getXor(self, A, N):
		x_r = 0
		for i in A:
			x_r = x_r ^ i
		c = []
		for i in A:
			c.append(x_r ^ i)
		return c


class Solution:

	def getXor(self, A, N):
		if N > 1:
			k = A[0] ^ A[1]
			for i in range(2, len(A)):
				k = k ^ A[i]
			l = []
			for i in range(len(A)):
				j = k ^ A[i]
				l.append(j)
			return l
		else:
			return '0'


class Solution:

	def getXor(self, A, N):
		x = 0
		for i in A:
			x = x ^ i
		for i in range(len(A)):
			A[i] = A[i] ^ x
		return A


class Solution:

	def getXor(self, A, N):
		c = A[0]
		l = []
		for i in range(1, len(A)):
			c = c ^ A[i]
		for i in range(len(A)):
			d = c ^ A[i]
			l.append(d)
		return l


class Solution:

	def getXor(self, a, N):
		x = 0
		for i in a:
			x ^= i
		lst = []
		for i in a:
			lst.append(x ^ i)
		return lst


class Solution:

	def getXor(self, A, N):
		value = 0
		for item in A:
			value = value ^ item
		return [item ^ value for item in A]


class Solution:

	def getXor(self, A, N):
		x = A[0]
		for i in range(1, N):
			x ^= A[i]
		B = []
		for i in range(N):
			B.append(x ^ A[i])
		return B


class Solution:

	def getXor(self, A, N):
		xor = 0
		for i in A:
			xor ^= i
		return [int(x) ^ xor for x in A]


class Solution:

	def getXor(self, A, N):
		XOR = A[0]
		for i in range(1, N):
			XOR = XOR ^ A[i]
		new = []
		ret = [int(i) ^ XOR for i in A]
		return ret


class Solution:

	def getXor(self, A, N):
		a = []
		k = 0
		sum1 = sum(A)
		for i in A:
			k = k ^ i
		for i in A:
			a.append(k ^ i)
		return a


from operator import xor
from functools import reduce

class Solution:

	def getXor(self, A, N):
		xor_val = reduce(xor, A)
		return [xor_val ^ num for num in A]


class Solution:

	def getXor(self, A, N):
		K = []
		x = 0
		for i in range(N):
			x = x ^ A[i]
		for i in A:
			K.append(x ^ i)
		return K


def indices(n):
	l = []
	i = 0
	while n > 0:
		if n % 2 == 1:
			l.append(i)
		n = n >> 1
		i += 1
	return l

class Solution:

	def getXor(self, A, N):
		total_xor = 0
		l = []
		for i in A:
			total_xor ^= i
		for i in range(N):
			ids = indices(A[i])
			p = total_xor
			for idx in ids:
				p = p ^ 1 << idx
			l.append(p)
		return l


class Solution:

	def getXor(self, A, N):
		k = []
		a = 0
		for i in range(0, N):
			a = a ^ A[i]
		for i in range(0, N):
			k.append(a ^ A[i])
		return k


class Solution:

	def getXor(self, A, N):
		xor = 0
		k = []
		for i in A:
			xor ^= i
		for i in range(len(A)):
			k.append(xor ^ A[i])
		return k


class Solution:

	def getXor(self, A, N):
		al = A[0]
		for i in A[1:]:
			al ^= i
		for i in range(N):
			A[i] = al ^ A[i]
		return A


class Solution:

	def getXor(self, A, N):
		if N == 1:
			return [0]
		x = 0
		c = A[0]
		for i in A[1:]:
			c = c.__xor__(i)
			x = c
		ans = []
		for i in A:
			ans.append(x.__xor__(i))
		return ans


class Solution:

	def getXor(self, a, n):
		xor = 0
		for i in range(len(a)):
			xor ^= a[i]
		for j in range(len(a)):
			a[j] = xor ^ a[j]
		return a


class Solution:

	def getXor(self, a, N):
		xor = a[0]
		for i in range(1, N):
			xor ^= a[i]
		for i in range(N):
			a[i] = xor ^ a[i]
		return a


from functools import reduce

class Solution:

	def getXor(self, A, N):
		xor = reduce(lambda a, b: a ^ b, A)
		l = []
		for i in A:
			l.append(xor ^ i)
		return l


class Solution:

	def getXor(self, A, N):
		tot_xor = 0
		for n in A:
			tot_xor ^= n
		for i in range(N):
			A[i] ^= tot_xor
		return A


class Solution:

	def getXor(self, A, N):
		r = []
		t = 0
		for i in range(N):
			t = t ^ A[i]
		for j in range(N):
			A[j] = t ^ A[j]
		return A


class Solution:

	def getXor(self, A, N):
		lst = A.copy()
		res = 0
		for itr in range(N):
			res = res ^ A[itr]
		for itr in range(N):
			lst[itr] = res ^ A[itr]
		return lst


class Solution:

	def getXor(self, A, N):
		ans = 0
		res = []
		for i in range(0, N):
			ans = ans ^ A[i]
		for i in range(0, N):
			res.append(ans ^ A[i])
		return res
if __name__ == '__main__':
	T = int(input())
	for i in range(T):
		N = int(input())
		A = [int(x) for x in input().split()]
		ob = Solution()
		ans = ob.getXor(A, N)
		for x in ans:
			print(x, end=' ')
		print('')


class Solution:

	def getXor(self, A, N):
		li = []
		curr = 0
		for i in range(N):
			curr ^= A[i]
		for i in range(N):
			li.append(curr ^ A[i])
		return li


class Solution:

	def getXor(self, A, N):
		ans = []
		xor = A[0]
		for j in range(1, N):
			xor ^= A[j]
		for j in range(N):
			ans.append(xor ^ A[j])
		return ans


class Solution:

	def getXor(self, A, N):
		ret = []
		xor = 0
		for a in A:
			xor ^= a
		for (ind, ele) in enumerate(A):
			xor ^= ele
			ret.append(xor)
			xor ^= ele
		return ret


from functools import reduce

class Solution:

	def getXor(self, A, N):
		xor = 0
		for i in A:
			xor = xor ^ i
		for i in range(N):
			A[i] = A[i] ^ xor
		return A


class Solution:

	def getXor(self, A, N):
		ans = A[0]
		for i in range(1, N):
			ans = ans ^ A[i]
		temp = [ans for i in range(N)]
		for i in range(N):
			temp[i] = temp[i] ^ A[i]
		return temp


class Solution:

	def getXor(self, A, N):
		s = 0
		l = []
		for i in range(N):
			s = s ^ A[i]
		for i in range(N):
			l.append(s ^ A[i])
		return l


class Solution:

	def getXor(self, A, N):
		overall_xor = 0
		result = []
		for i in range(N):
			overall_xor ^= A[i]
		for i in range(N):
			result.append(overall_xor ^ A[i])
		return result


class Solution:

	def getXor(self, A, N):
		res = 0
		for i in A:
			res = res ^ i
		ans = []
		for j in A:
			ans.append(res ^ j)
		return ans


class Solution:

	def getXor(self, A, N):
		res = []
		xors = 0
		for i in range(N):
			xors = xors ^ A[i]
		for i in range(N):
			res.append(xors ^ A[i])
		return res