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