#include <bits/stdc++.h>
using namespace std;
signed main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    int maxi = 0;
    cin >> n;
    int a[n];
    int b[n];
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      maxi = max(maxi, a[i]);
    }
    for (int i = 0; i < n; i++) {
      b[i] = maxi - a[i];
    }
    bool flag = true;
    for (int i = 0; i < n; i++) {
      if (b[i] & 1) {
        flag = false;
        break;
      }
    }
    if (flag)
      cout << "YES";
    else
      cout << "NO";
    cout << endl;
  }
}
