#include <bits/stdc++.h>
using namespace std;
int s[105];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> s[i];
    s[0] = *max_element(s + 1, s + 1 + n);
    int ned = 0;
    for (int i = 1; i <= n; i++) ned += (s[0] - s[i]) % 2;
    cout << (ned == 0 || ned == n ? "YES" : "NO") << endl;
  }
  return 0;
}
