#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, x, t;
  cin >> t;
  while (t--) {
    vector<long long> v;
    cin >> n;
    for (long long i = 0; i < n; i++) {
      cin >> x;
      v.push_back(x);
    }
    sort(v.begin(), v.end());
    long long len = v.size();
    long long count = 0;
    long long mx = v[len - 1];
    for (long long i = 0; i < v.size(); i++) {
      v[i] = mx - v[i];
      if (v[i] % 2 == 0)
        count++;
      else
        break;
    }
    if (count == v.size())
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
