#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
long long ar[N];
int br[N], n, m;
void s1() {
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    int mx = 0, fg = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d", br + i);
      mx = max(m, br[i]);
    }
    for (int i = 0; i < n; i++) {
      if ((mx - br[i]) % 2) {
        fg = 1;
        break;
      }
    }
    if (fg)
      puts("NO");
    else
      puts("YES");
  }
}
int main() { s1(); }
