#include <bits/stdc++.h>
using namespace std;
template <typename T>
void __f(const char*, T&&);
template <typename T1, typename... T2>
void __f(const char*, T1&&, T2&&...);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> v(n);
    int odd = 0, even = 0;
    for (auto& i : v) {
      cin >> i;
      if (i % 2 == 0)
        even++;
      else
        odd++;
    }
    if (odd > 0 && even > 0)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  return 0;
}
template <typename T>
void __f(const char* variable_name, T&& value) {
  cout << variable_name << ": " << value << endl;
}
template <typename T1, typename... T2>
void __f(const char* names, T1&& arg1, T2&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
