// compile: make data
// run: ./data < data.in
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#ifdef LOCAL
#include <debug/codeforces.h>
#define debug(x...) _debug_print(#x, x);
#else
#define debug(x...) {};
#endif
template<typename...Args> void print_(Args...args){((cout<<args<<" "),...)<<endl;}
#define rep(i,a,b) for(int i=(a);i<(int)(b);++i)
#define sz(v) ((int)(v).size())
#define print(...) print_(__VA_ARGS__);
#define INTMAX (int)(9223372036854775807)
#define INF (int)(1152921504606846976)
#define double long double
#define int long long
#define MAXN 200010
void solve() {
int n; cin >> n;
vector<int> a(n);
int odd = 0, even = 0;
rep(i, 0, n) cin >> a[i];
sort(a.begin(), a.end(), greater<int>());
auto it = unique(a.begin(), a.end());
a.resize(distance(a.begin(), it));
int to = 0, te = 0;
rep(i, 0, sz(a)) {
if (a[i] & 1) ++odd;
else ++even;
}
rep(i, 0, sz(a)) {
if (a[i] & 1) {
++to, --odd;
if (odd > 0) ++te;
}
else {
++te, --even;
if (odd > 0) ++to;
}
}
if (te == sz(a) || to == sz(a)) cout << "YES" << endl;
else cout << "NO" << endl;
}
int32_t main() {
ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
int _; cin >> _;
while (_--) solve();
return 0;
}
No Comments