#include <bits/stdc++.h>
using namespace std;
const long long MAX1 = 1e6 + 7, MOD = 998244353;
long long q, n, m, x, flag;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> q;
  while (q--) {
    cin >> n;
    cin >> m;
    m = m % 2;
    flag = 1;
    for (int i = 0; i < n - 1; ++i) {
      cin >> x;
      if (x % 2 != m) flag = 0;
    }
    if (flag)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
