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