#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int a[n];
    long long int ct = 0, cto = 0;
    for (long long int i = 0; i < n; ++i) {
      cin >> a[i];
      if (a[i] % 2)
        ct++;
      else
        cto++;
    }
    if (ct == n || cto == n)
      cout << "YES"
           << "\n";
    else
      cout << "NO"
           << "\n";
  }
}
