#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int a[n], i;
    for (i = 0; i < n; i++) cin >> a[i];
    int k = *min_element(a, a + n);
    for (i = 0; i < n; i++) {
      if ((a[i] - k) & 1) {
        cout << "NO"
             << "\n";
        break;
      }
    }
    if (i == n) cout << "YES\n";
  }
}
