#include <bits/stdc++.h>
using namespace std;
int n, t, i, prv;
vector<int> a;
bool done = false;
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    a.resize(n);
    for (i = 0; i < n; i++) {
      cin >> a[i];
      if (i >= 1 && a[i] % 2 != prv) {
        done = true;
      }
      prv = a[i] % 2;
    }
    if (done == false) {
      cout << "YES"
           << "\n";
    } else {
      cout << "NO"
           << "\n";
    }
    done = false;
    a.resize(0);
  }
  return 0;
}
