#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
  int t, a, b, c;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> arr;
    int mi = INT_MAX;
    for (int i = 0; i < n; i++) {
      int num;
      cin >> num;
      arr.push_back(num);
      mi = min(mi, num);
    }
    int flag = 0;
    for (int i = 0; i < n; i++) {
      arr[i] = arr[i] - mi;
      if (arr[i] % 2 != 0) {
        flag = 1;
        break;
      }
    }
    if (flag == 1)
      cout << "NO" << endl;
    else
      cout << "YES\n";
  }
}
