Amit is going on a date and he wants to gift his date an array of positive numbers. But he is running short on money. He already has an array of numbers in design. Cost of an array of numbers is the sum of elements in it. But he wants to minimize the cost of making it. 
So he does the following number of operations one by one for any number of times:
He chooses two adjacent elements ,replace them by one element with value = XOR of the two numbers. This operation reduces length of array (and elements are re-numerated accordingly)
Find the minimum amount of money that Amit needs to spend to gift his date.

-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow. 
- Each testcase contains of $2$ lines of input, first line contains a single integer $N$ and the second line contains $N$ elements - $A1,A2,A3,.....,AN$ 

-----Output:-----
For each testcase, output in a single line answer denoting the minimum cost

-----Constraints-----
- $1 \leq T \leq 10$
- $1 \leq N \leq 10^5$
- $0 \leq Ai \leq 10^9$ for $1\leq i \leq N$

-----Sample Input:-----
3
5
8 4 1 5 0
5
1 2 4 0 8
2
10 10

-----Sample Output:-----
8
15
0

-----EXPLANATION:-----
For first case,
This array is :
$[8,4,1,5,0] -> [8,4,4,0] -> [8,0,0]$. Sum=$8$ So the answer is 8.

Starter code:

Solutions:
for _ in range(int(input())):
    n=int(input())
    l=list(map(int,input().split()))
    su=l[0]
    for i in range(1,n):
        su^=l[i]
    print(su)

# cook your dish here
t = int(input())
for _ in range(t):
    n = int(input())
    a = list(map(int,input().split()))
    x = 0
    for i in range(0,len(a)):
        x = x^a[i]
    print(x)

# cook your dish here
t = int(input())
for _ in range(t):
    n = int(input())
    a = list(map(int,input().split()))
    x = 0
    for i in range(0,len(a)):
        x = x^a[i]
    print(x)

for _ in range(int(input())):
    n=int(input())
    a=[int(X ) for X in input().split()]
    x=0
    for i in a:
       x^=i
    print(x)# cook your dish here


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

# cook your dish here
for _ in range(int(input())):
    n=int(input())
    li=list(map(int,input().split()))
    l=len(li)
    res=li[0]
    for i in range(1,l):
        res=res^li[i]
    print(res)

# cook your dish here
t=int(input())
for _ in range(t):
    n=int(input())
    l=list(map(int,input().split()))
    s=0
    l.sort()
    for i in range(n):
        s=s^l[i]
        #s=s^i
    print(s)        

from functools import reduce
for _ in range(int(input())) :
    n = int(input())
    arr = list(map(int, input().split()))
    arr.sort()
    print(reduce(lambda x, y: x^y, arr))

# cook your dish here
t=int(input())
while(t):
    n=int(input())
    #n,k=map(int,input().split())
    l=list(map(int,input().split()))
    ans=0
    for i in range(len(l)):
        #print(ans^l[i])
        ans=(ans^l[i])
        
    print(ans)
    t-=1

t=int(input())

for t1 in range(t):
    n=int(input())
    a=list(map(int,input().split()))
    s=bin(a[0])[2:]
    s1=a[0]
    for i in range(1,n):
        x=bin(a[i])[2:]
        
        if len(s)>len(x):
            j=1
            s1=''
            while j<=len(x):
                if s[-j]==x[-j]:
                    s1+="0"
                else:
                    s1+="1"
                j+=1
            
            while j<=len(s):
                s1+=s[-j]
                j+=1
            
            s=s1[::-1]
        else:
            j=1
            s1=''
            while j<=len(s):
                if s[-j]==x[-j]:
                    s1+="0"
                else:
                    s1+="1"
                j+=1

            while j<=len(x):
                s1+=x[-j]
                j+=1
            
            s=s1[::-1]
            
    s="0b"+s
    print(int(s,2))

                




t=int(input())

for t1 in range(t):
    n=int(input())
    a=list(map(int,input().split()))
    s=bin(a[0])[2:]
    s1=a[0]
    for i in range(1,n):
        x=bin(a[i])[2:]
        
        if len(s)>len(x):
            j=1
            s1=''
            while j<=len(x):
                if s[-j]==x[-j]:
                    s1+="0"
                else:
                    s1+="1"
                j+=1
            
            while j<=len(s):
                s1+=s[-j]
                j+=1
            
            s=s1[::-1]
        else:
            j=1
            s1=''
            while j<=len(s):
                if s[-j]==x[-j]:
                    s1+="0"
                else:
                    s1+="1"
                j+=1

            while j<=len(x):
                s1+=x[-j]
                j+=1
            
            s=s1[::-1]
            
    s="0b"+s
    print(int(s,2))

                




t=int(input())
for _ in range(t):
    n=int(input())
    l=list(map(int,input().split()))
    s=[l[0]]
    for i in range(0,n-1):
        s.append(s[i]^l[i+1])
    print(s[-1])

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

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

# cook your dish here
test = int(input())

for i in range(test):
    n = int(input())
    val = list(map(int,input().split()))


    x = 0
    if(len(val)==n):
        for i in val:
            x^=i
        print(x)


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

# cook your dish here
tc = int(input())
while tc:
    tc -= 1
    n = int(input())
    lst = list(map(int, input().split()))
    t = 0
    for x in lst:
        t = t^x
    print(t)

t=int(input())
while t>0:
    t=t-1
    n=int(input())
    l=list(map(int,input().split()))
    q=0
    for i in l:
        q=q^i
    print(q)

# cook your dish here
for i in range(int(input())):
    n=int(input())
    arr=list(map(int,input().split()))
    ans=0
    for i in arr:
        ans^=i
    print(ans)

import sys
import math
import bisect
from sys import stdin,stdout
from math import gcd,floor,sqrt,log
from collections import defaultdict as dd
from bisect import bisect_left as bl,bisect_right as br

sys.setrecursionlimit(100000000)

ii     =lambda: int(input())
si     =lambda: input()
jn     =lambda x,l: x.join(map(str,l))
sl     =lambda: list(map(str,input().strip()))
mi     =lambda: list(map(int,input().split()))
mif    =lambda: list(map(float,input().split()))
lii    =lambda: list(map(int,input().split()))

ceil   =lambda x: int(x) if(x==int(x)) else int(x)+1
ceildiv=lambda x,d: x//d if(x%d==0) else x//d+1

flush  =lambda: stdout.flush()
stdstr =lambda: stdin.readline()
stdint =lambda: int(stdin.readline())
stdpr  =lambda x: stdout.write(str(x))

mod=1000000007


#main code
for _ in range(ii()):
    n=ii()
    arr=lii()
    sol=0
    for ele in arr:
        sol=sol^ele
    print(sol)
    


for _ in range(int(input())):
    n = int(input())
    ls =  list(map(int,input().rstrip().split(" ")))
    res=ls[0]
    for i in range(1,n):
   
        res=res^ls[i]
    print(res)




for _ in range(int(input())):
    n=int(input())
    l=list(map(int,input().split()))
    ans=0
    for i in l:
        ans^=i
    print(ans)







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




for _ in range(int(input())):
    n=int(input())
    l=list(map(int,input().split()))
    ans=0
    for i in l:
        ans^=i
    print(ans)







# cook your dish here
t=int(input())
w=[]
for _ in range(t):
    n=int(input())
    s=list(map(int,input().split()))
    a=s[0]^s[1]
    for i in range(n-2):
        a=a^s[i+2]
    w.append(a)
for i in w:
    print(i)