#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int ttt;
  cin >> ttt;
  for (long long int yui = 0; yui < ttt; ++yui) {
    long long int n, e = 0;
    cin >> n;
    long long int a[n];
    for (long long int i = 0; i < n; ++i) {
      cin >> a[i];
      if (a[i] % 2 == 0) ++e;
    }
    if (n == e || e == 0)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
