#include <bits/stdc++.h>
using namespace std;
vector<int> A;
int n, T;
void xuly() {
  for (int i = 0; i < n; ++i) {
    if ((A[i] - A[0]) % 2) {
      cout << "NO" << endl;
      return;
    }
  }
  cout << "YES" << endl;
}
void nhap() {
  cin >> T;
  while (T--) {
    cin >> n;
    A.resize(n);
    for (int i = 0; i < n; ++i) cin >> A[i];
    xuly();
  }
}
int main() {
  nhap();
  return 0;
}
