#include <bits/stdc++.h>
using namespace std;
void tetris(int k) {
  int odd = 0;
  int even = 0;
  for (int i = 1; i <= k; i++) {
    int j;
    cin >> j;
    if (j & 1) {
      odd++;
    } else {
      even++;
    }
  }
  if (odd == k || even == k) {
    cout << "YES" << '\n';
  } else {
    cout << "NO" << '\n';
  }
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int y;
    cin >> y;
    tetris(y);
  }
  return 0;
}
