#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const long long EPS = -1e18;
const long long MOD1 = 1e9 + 7;
const long long MOD2 = (119 << 23) + 1;
long long t, n, even, odd;
vector<long long> a;
void solution() {
  cin >> n;
  a.resize(n);
  even = 0;
  odd = 0;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
    if (a[i] & 1)
      ++odd;
    else
      ++even;
  }
  cout << (even == n || odd == n ? "YES" : "NO") << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(13);
  cin >> t;
  while (t--) solution();
}
