#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int x;
    cin >> x;
    int y;
    int flag = 0;
    for (int i = 1; i < n; i++) {
      cin >> y;
      if (abs(x - y) & 1) flag = 1;
    }
    if (flag == 0)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
