#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const bool test_cases = 1;
const ll maxn = 2e5 + 55;
const ll mod = 1e9 + 7;
void solve() {
  ll n, mx = 0, a[1005];
  cin >> n;
  bool no = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    mx = max(mx, a[i]);
  }
  for (int i = 1; i <= n; ++i) {
    if ((mx - a[i]) % 2 == 1) no = 1;
  }
  if (no)
    cout << "NO\n";
  else
    cout << "YES\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  if (test_cases) cin >> t;
  while (t--) solve();
  return 0;
}
