#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long x;
    cin >> x;
    vector<long long> a;
    for (long long i = 0; i < x; i++) {
      long long k;
      cin >> k;
      a.push_back(k);
    }
    if (x == 1) {
      cout << "YES" << endl;
      continue;
    }
    sort(a.begin(), a.end());
    bool flag = 1;
    for (long long i = x - 2; i >= 0; i--) {
      if ((a[i + 1] - a[i]) % 2 == 1) flag = 0;
    }
    if (flag)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
