#include <bits/stdc++.h>
using namespace std;
int a[1000];
int main() {
  int tt;
  scanf("%d", &tt);
  while (tt--) {
    int n;
    scanf("%d", &n);
    int ok = 1;
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    int maxx = -1;
    for (int i = 1; i <= n; i++) maxx = max(maxx, a[i]);
    for (int i = 1; i <= n; i++) {
      if (a[i] == maxx)
        continue;
      else {
        if ((maxx - a[i]) % 2) {
          ok = 0;
          break;
        }
      }
    }
    if (!ok)
      printf("NO\n");
    else
      printf("YES\n");
  }
}
