#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n;
  cin >> t;
  while (t--) {
    cin >> n;
    int ar[n], e = 0, o = 0;
    for (int i = 0; i < n; i++) cin >> ar[i];
    for (int i = 0; i < n; i++) {
      if (ar[i] % 2 == 0)
        e = e + 1;
      else
        o = o + 1;
    }
    if ((e == n) || (o == n))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
