#include <iostream>
#include <vector>
#include <numeric>
using namespace std;
// 设原数组是{a. b}, x = a ^ b;
// 新数组为{a, b, a^b}
// 尝试取数组第一个数为x, x = a;
// 则应该有剩下元素的按位异或结果 = x,
// 即应该有(a^b) ^ a = b这个等式成立
// 这个等式利用按位异或满足交换律和结合律就能验证是成立的!
// 那么我们可以猜想,新数组的第一个元素就是x
// 例子:旧数组{a, b, c} -> 新数组{a, b, c, a^b^c}
// 取新数组第一个元素x = a
// 则要有 b ^ c ^ (a^b^c) = a;
// 等式成立!
// 我们只需要将新数组的第一个元素输出出来就能解决此题
void solve() {
int m;
cin >> m;
// 只需要读取第一个数作为答案
int first_element;
cin >> first_element;
// 读取并忽略剩余的 m-1 个数
for (int i = 1; i < m; ++i) {
int temp;
cin >> temp;
}
cout << first_element << endl;
}
int main() {
int t;
cin >> t;
while (t--) {
solve();
}
return 0;
}
