#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  int a[n], min = INT_MAX, flag = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (min > a[i]) min = a[i];
  }
  for (int i = 0; i < n; i++) {
    if (a[i] - min == 0 || (a[i] - min) % 2 == 0) {
      continue;
    } else {
      flag = 1;
      break;
    }
  }
  if (flag == 1) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
  }
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
