#include <bits/stdc++.h>
using namespace std;
int const MAXN = 2e6 + 9;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      if (x & 1) cnt++;
    }
    if (cnt == 0 or cnt == n) {
      cout << "YES" << '\n';
    } else
      cout << "NO" << '\n';
  }
}
