#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int num;
    long long int even = 0, odd = 0;
    while (n--) {
      cin >> num;
      if (num % 2 == 0)
        even++;
      else
        odd++;
    }
    if (even == 0 || odd == 0)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
