#include <bits/stdc++.h>
unsigned long long int mod = 1e9 + 7;
using namespace std;
int make_int(string s) {
  int x = 0;
  reverse(s.begin(), s.end());
  string tmp = s;
  for (int i = 0; i < s.length(); ++i) {
    x *= 10;
    x += (int)(tmp.back() - '0');
    tmp.pop_back();
  }
  return x;
}
string make_string(int s) {
  string x;
  while (s) {
    x.push_back(char(s % 10 + '0'));
    s /= 10;
  }
  reverse(x.begin(), x.end());
  return x;
}
void solve() {
  int n;
  cin >> n;
  int zz = -1;
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    a %= 2;
    if (zz == -1)
      zz = a;
    else if (zz != a)
      zz = 3;
  }
  if (zz == 3) {
    cout << "NO" << endl;
    return;
  } else {
    cout << "YES" << endl;
    return;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
