#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL INF=-1e18;
int t;
int n;
int a[105];
//不会技巧的想法就暴力了……orz
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>t;
    while(t--){
        cin>>n;
        for(int i=0;i<n;i++){
            cin>>a[i];
        }
        for(int i=0;i<n;i++){
            int sum=0;//0异或任何数依旧等于任何数
            for(int j=0;j<n;j++){
                if(j==i)continue;
                else{
                    sum^=a[j];
                }
            }
            if(sum==a[i]){
                cout<<a[i]<<'\n';
                break;
            }
        }
    }
    return 0;
}