#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, i, a, b, n;
  bool d = true;
  cin >> t;
  while (t--) {
    cin >> n >> a;
    d = true;
    n--;
    while (n > 0) {
      cin >> b;
      if (a % 2 != b % 2) d = false;
      n--;
    }
    if (d)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
