#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t, a, x;
  cin >> t;
  for (int i = 0; i < t; ++i) {
    bool okay = true;
    cin >> n;
    a = 0;
    cin >> a;
    a %= 2;
    for (int j = 1; j < n; ++j) {
      cin >> x;
      if (x % 2 != a) {
        okay = false;
      }
    }
    if (okay)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
