#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int q = 1;
  cin >> q;
  while (q--) {
    long long int n, i, sum = 0, t;
    cin >> n;
    for (long long int i = 0; i < n; i++) {
      cin >> t;
      sum += t % 2;
    }
    if (sum % n == 0)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
