#include <iostream>
using namespace std;
// n=2
// 0 0 -> 0
// 1 0 -> 1
// 0 1 -> 1
// 1 1 -> 0
// inner loop : a_i&a1 | a_i&a2 | ... a_i&an, if(a_i==1) ->1
// if (a_i == 0) --> 0
// inner loop = a_i

int solve(){
    int n;
    cin >> n;
    int ans = 0;
    while(n--){
        int num;
        cin >> num;
        ans^=num;
    }
    return ans;
}

int main() {
    int t;
    cin >> t;
    while(t--){
        cout << solve()<< endl;
    }
}
// 64 位输出请用 printf("%lld")