#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  vector<vector<int>> v;
  for (int i = 0; i < t; i++) {
    int n, q;
    cin >> n;
    vector<int> temp;
    for (int j = 0; j < n; j++) {
      cin >> q;
      temp.push_back(q);
    }
    v.push_back(temp);
  }
  vector<string> ans;
  for (int i = 0; i < t; i++) {
    int fo = 0, fe = 0;
    for (int j = 0; j < v[i].size(); j++) {
      if (v[i][j] % 2 == 0) {
        fe = 1;
      } else {
        fo = 1;
      }
    }
    if (fo == 0 || fe == 0) {
      ans.push_back("YES");
    } else
      ans.push_back("NO");
  }
  for (int i = 0; i < t; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}
