#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int n;
    cin >> n;
    bool flag = true;
    int a1;
    cin >> a1;
    for (int j = 0; j < n - 1; j++) {
      int a2;
      cin >> a2;
      if ((a2 % 2) != (a1 % 2)) flag = false;
    }
    if (flag)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
