#include <bits/stdc++.h>
using namespace std;
void doit() {
  int n;
  cin >> n;
  int a = 0, b = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x & 1)
      a++;
    else
      b++;
  }
  if (a == n || b == n)
    cout << "YES\n";
  else
    cout << "NO\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    doit();
  }
}
