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