#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, i, x = 0;
    cin >> n;
    long long int a[n];
    for (i = 0; i < n; ++i) {
      cin >> a[i];
    }
    if (n == 1) {
      cout << "YES\n";
      continue;
    }
    for (i = 1; i < n; ++i) {
      if ((a[i] - a[i - 1]) % 2 != 0) {
        x++;
        cout << "NO\n";
        break;
      }
    }
    if (x == 0) {
      cout << "YES\n";
    }
  }
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
  return 0;
}
