#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    bool flag = true;
    int m = 0;
    for (int i : a) {
      m = max(m, i);
    }
    for (int i : a) {
      if ((m - i) % 2) {
        flag = false;
        break;
      }
    }
    if (flag)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
