#include <bits/stdc++.h>
using namespace std;
int main() {
  int test, n;
  cin >> test;
  while (test--) {
    cin >> n;
    vector<int> a(n);
    int g = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      if (i != 0) {
        if (a[i] != a[0]) {
          g = 1;
        }
      }
    }
    if (g == 0) {
      cout << "YES\n";
      continue;
    }
    int f = 0;
    for (int i = 0; i < n - 1; i++) {
      int j = i + 1;
      if (abs(a[i] - a[j]) % 2 != 0) {
        f = 1;
        break;
      }
    }
    if (f == 0)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
