#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    int n;
    vector<int> v;
    cin >> n;
    int max = 0, mp;
    for (int i = 0; i < n; ++i) {
      int temp;
      cin >> temp;
      v.push_back(temp);
      if (temp > max) {
        max = temp;
        mp = i;
      }
    }
    bool flag = false;
    for (int i = 0; i < n; ++i) {
      if ((max - v[i]) % 2 != 0) {
        flag = true;
        break;
      }
    }
    if (flag)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  return 0;
}
