#include <bits/stdc++.h>
using namespace std;
const int NN = 1e6 + 7;
const int N = 1e3 + 7;
const int M = 33;
const int mod = 1e9 + 7;
const long long inf = 1e18 + 7;
void solve1() {
  int n;
  cin >> n;
  vector<int> v(2);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    v[x % 2] += 1;
  }
  if (!v[0] || !v[1])
    cout << "YES\n";
  else
    cout << "NO\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  srand(time(0));
  int cghf = 1;
  cin >> cghf;
  while (cghf--) {
    solve1();
  }
}
