#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  bool ans;
  while (t--) {
    int n;
    cin >> n;
    int x;
    cin >> x;
    int y;
    ans = true;
    for (int i = 1; i < n; i++) {
      cin >> y;
      if ((x % 2) != (y % 2)) {
        ans = false;
      }
    }
    if (ans) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  }
}
