#include <bits/stdc++.h>
using namespace std;
int a[1005];
int main() {
  int T;
  cin >> T;
  while (T--) {
    int n, maxn = 0;
    cin >> n;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      maxn = max(maxn, a[i]);
    }
    bool ok = 1;
    for (int i = 1; i <= n; i++)
      if ((maxn - a[i]) % 2) {
        ok = 0;
        break;
      }
    if (ok)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
