#include <bits/stdc++.h>
using namespace std;
int main() {
  int N = 0;
  cin >> N;
  for (int o = 0; o < N; o++) {
    int n;
    cin >> n;
    int mod;
    bool ans = true;
    for (int i = 0; i < n; i++) {
      int a_i;
      cin >> a_i;
      if (i == 0) {
        mod = a_i % 2;
      }
      if (a_i % 2 != mod) {
        ans = false;
      }
    }
    if (ans) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
