#include <bits/stdc++.h>
using namespace std;
void foobar() {
  long long int n, i;
  cin >> n;
  vector<long long int> arr(n);
  long long int mm = INT_MAX;
  for (i = 0; i < n; ++i) {
    cin >> arr[i];
    mm = min(mm, arr[i]);
  }
  for (i = 0; i < n; ++i) {
    arr[i] -= mm;
    if (arr[i] % 2) {
      cout << "NO" << endl;
      return;
    }
  }
  cout << "YES" << endl;
}
int main() {
  long long int test;
  cin >> test;
  while (test--) foobar();
}
