#include <bits/stdc++.h>
using namespace std;
int n, i, nr;
int maxim, k, ok, t, v[105];
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    maxim = 0;
    for (i = 1; i <= n; i++) {
      cin >> v[i];
      maxim = max(maxim, v[i]);
    }
    ok = 1;
    for (i = 1; i <= n && ok; i++) {
      k = maxim - v[i];
      if (k % 2 == 1) {
        ok = 0;
      }
    }
    if (ok)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
