#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    cnt = 0;
    int x;
    cin >> x;
    for (int i = 0; i < x; i++) {
      int p;
      cin >> p;
      if (p % 2 == 0) cnt++;
    }
    if (cnt == 0 or cnt == x)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
