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


int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
	int t;
	cin >> t;
	while (t--) {
		int n;
		cin >> n;
		int arr[n];
		for (int i = 0; i < n; i++) {
			cin >> arr[i];
		}

		int value = 0;
		for (int i = 0; i < n; i++) {
			value ^= arr[i];
		}
		if (value == 0) {
			cout << "YES" << endl;
		}
		else {
			int k = 0, count = 0;
			for (int i = 0; i < n; i++) {
				k ^= arr[i];
				if (k == value) {
					k = 0;
					count++;
				}
			}
			if (count > 2) {
				cout << "YES" << endl;
			}
			else {
				cout << "NO" << endl;
			}
		}

	}
	return 0;
}