#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t, max, temp;
  cin >> n;
  while (n--) {
    cin >> t;
    int arr[t], f = 0;
    max = 0;
    for (int i = 0; i < t; i++) {
      cin >> temp;
      if (temp > max) {
        max = temp;
      }
      arr[i] = temp;
    }
    for (int i = 0; i < t; i++) {
      if ((arr[i] - max) % 2 != 0) {
        f = 1;
        break;
      }
    }
    if (f == 0)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
