#include <bits/stdc++.h>
#include <cstring>
using namespace std;

//数组:a1, a2, a3, a4... an-1, x
// 如此设置,a1 = a2^a3^...^an-1^x = a1, 这样数组中每一个数都是其余n-1个数的异或和
int main() {
    int t; 
    cin >> t;
    int n;
    int a[109] = {};
    for(int i = 0; i < t; ++i){
        cin >> n;
        memset(a, 0, sizeof(a));
        for(int j = 0; j < n; ++j){
            cin >> a[j];
        }
        cout << a[0] << endl;
    }
}
// 64 位输出请用 printf("%lld")