#include <bits/stdc++.h>
using namespace std;
void solve(long long t) {
  while (t--) {
    long long i, j, k, l, m, n, e = 0, o = 0;
    cin >> n;
    long long arr[n];
    for (i = 0; i < n; i++) {
      cin >> arr[i];
      if (arr[i] % 2 == 0)
        e = 1;
      else
        o = 1;
    }
    if (n == 1)
      cout << "YES\n";
    else {
      if (e == 1 && o == 1)
        cout << "NO\n";
      else {
        cout << "YES\n";
      }
    }
  }
  return;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  solve(t);
  return 0;
}
