#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int j = 0; j < n; j++) cin >> a[j];
    string ans = "YES\n";
    for (int j = 0; j < n - 1; j++) {
      if ((a[j] + a[j + 1]) % 2) ans = "NO\n";
    }
    cout << ans;
  }
}
