#include <bits/stdc++.h>
using namespace std;
const string alf = "abcdefghijklmnopqrstuvwxyz";
const int hashP = 239017;
const int N = 1e5 + 10;
const int MOD = 1e9 + 7;
const int MOD2 = 998244353;
const int INF = 1e9;
const long long INF2 = 1e18;
template <typename T>
bool umn(T &a, T b) {
  return (a > b ? (a = b, 1) : 0);
}
template <typename T>
bool umx(T &a, T b) {
  return (a < b ? (a = b, 1) : 0);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int tt;
  cin >> tt;
  while (tt--) {
    int n;
    cin >> n;
    vector<long long> a(n);
    for (auto &now : a) cin >> now;
    if (n == 1) {
      cout << "YES\n";
      continue;
    }
    bool ok1 = 0, ok2 = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] % 2 == 0)
        continue;
      else
        ok1 = 1;
    }
    for (int i = 0; i < n; i++) {
      if (a[i] % 2 == 1)
        continue;
      else
        ok2 = 2;
    }
    if (ok1 && ok2)
      cout << "NO\n";
    else
      cout << "YES\n";
  }
  return 0;
}
