#include <bits/stdc++.h>
using namespace std;
struct node {
  int first, second;
  bool operator<(const node& b) const { return second > b.second; }
};
priority_queue<node> que;
int n, k;
int num[1000000 + 5], top;
map<int, int> ap;
int mi(int first, int p) {
  int ans = 1, num = first;
  while (p) {
    if (p & 1) {
      ans *= num;
      ans %= 998244353;
    }
    num = num * num;
    num %= 998244353;
    p /= 2;
  }
  return ans;
}
int C(int n, int m) {
  int ans = 1;
  for (int i = m; i > m - n; i--) {
    ans *= i;
    ans %= 998244353;
  }
  for (int i = 1; i <= n; i++) {
    ans *= mi(i, 998244353 - 2);
    ans %= 998244353;
  }
  return ans;
}
void solve() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &num[i]);
  }
  if (n == 1) {
    printf("YES\n");
    return;
  }
  int flag = 0;
  for (int i = 1; i < n; i++) {
    if ((num[i] - num[i - 1]) % 2) flag = 1;
  }
  if (flag)
    printf("NO\n");
  else
    printf("YES\n");
}
signed main() {
  int t = 1;
  scanf("%d", &t);
  while (t--) {
    solve();
  }
}
