#include <bits/stdc++.h>
using namespace std;
int main() {
  int tc;
  cin >> tc;
  while (tc--) {
    int n;
    cin >> n;
    int a[n], odd = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      if (a[i] & 1) {
        odd++;
      }
    }
    if (odd == 0 || odd == n) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}
