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