#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n, s1 = 0, s2 = 0;
    scanf("%d", &n);
    int a[100] = {0};
    for (int i = 0; i < n; i++) {
      scanf("%d", a + i);
      if (a[i] % 2)
        s1++;
      else
        s2++;
    }
    if (s1 && s2)
      printf("NO\n");
    else
      printf("YES\n");
  }
  return 0;
}
