#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> A(n);
    int mn = 1e7, mx = -1e7;
    int odd = 0, even = 0;
    for (int i = 0; i < n; i++) {
      cin >> A[i];
      if (A[i] % 2) {
        even++;
      } else {
        odd++;
      }
    }
    string ans = (even && odd) ? "NO\n" : "YES\n";
    cout << ans;
  }
}
