#include <bits/stdc++.h>
using namespace std;
long long int mod = 1000000007;
int main() {
  long long int n, t, i, mx;
  cin >> t;
  while (t--) {
    mx = INT_MIN;
    cin >> n;
    long long int a[n];
    for (i = 0; i < n; i++) {
      cin >> a[i];
      mx = (a[i] > mx) ? a[i] : mx;
      ;
    }
    for (i = 0; i < n; i++) {
      if ((mx - a[i]) % 2 != 0) break;
    }
    if (i == n)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
