#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, n, num, max, a[100000], l, p, s;
  cin >> num;
  while (num--) {
    cin >> n;
    for (i = 1; i <= n; i++) {
      cin >> a[i];
    }
    max = a[1];
    for (i = 1; i <= n; i++) {
      if (a[i] > max) max = a[i];
    }
    l = 0;
    p = 0;
    for (i = 1; i <= n; i++) {
      s = max - a[i];
      if (s % 2 == 0)
        l++;
      else
        p++;
    }
    if (p > 0)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  return 0;
}
