#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long inv(long long i) {
  if (i == 1) return 1;
  return (mod - ((mod / i) * inv(mod % i)) % mod) % mod;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long pwr(long long a, long long b) {
  a %= mod;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return res;
}
class Graph {
  long long V;
  list<long long> *adj;

 public:
  Graph(long long V);
  void addEdge(long long v, long long w);
  void BFS(long long s);
  void DFS(int v);
};
Graph::Graph(long long V) {
  this->V = V;
  adj = new list<long long>[V];
}
void Graph::addEdge(long long v, long long w) { adj[v].push_back(w); }
void Graph::BFS(long long s) {
  bool *visited = new bool[V];
  for (long long i = 0; i < V; i++) visited[i] = false;
  list<long long> queue;
  visited[s] = true;
  queue.push_back(s);
  list<long long>::iterator i;
  while (!queue.empty()) {
    s = queue.front();
    cout << s << " ";
    queue.pop_front();
    for (i = adj[s].begin(); i != adj[s].end(); ++i) {
      if (!visited[*i]) {
        visited[*i] = true;
        queue.push_back(*i);
      }
    }
  }
}
long long findMinNumber(long long n) {
  long long count = 0, ans = 1;
  while (n % 2 == 0) {
    count++;
    n /= 2;
  }
  if (count % 2) ans *= 2;
  for (int i = 3; i <= sqrt(n); i += 2) {
    count = 0;
    while (n % i == 0) {
      count++;
      n /= i;
    }
    if (count % 2) ans *= i;
  }
  if (n > 2) ans *= n;
  return ans;
}
long long binarySearch(long long arr[], long long l, long long r, long long x) {
  if (r >= l) {
    long long mid = l + (r - l) / 2;
    if (arr[mid] == x) return mid;
    if (arr[mid] > x) return binarySearch(arr, l, mid - 1, x);
    return binarySearch(arr, mid + 1, r, x);
  }
  return -1;
}
long long nCrModp(long long n, long long r, long long p) {
  if (r > n - r) r = n - r;
  long long C[r + 1];
  memset(C, 0, sizeof(C));
  C[0] = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = min(i, r); j > 0; j--) C[j] = (C[j] + C[j - 1]) % p;
  }
  return C[r];
}
long long fact(long long n, long long mod) {
  long long p = 1;
  if (n == 0)
    return 1;
  else {
    for (int i = 1; i <= n; i++) {
      p *= i;
      p = p % mod;
    }
    return p;
  }
}
long long count_set_bit(long long n) {
  long long count = 0;
  while (n) {
    count += n & 1;
    n >>= 1;
  }
  return count;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long a[n], i, c1 = 0, c2 = 0;
    for (i = 0; i < n; i++) {
      cin >> a[i];
      if (a[i] % 2 == 0)
        c1++;
      else
        c2++;
    }
    if (c1 != 0 and c2 != 0)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  return 0;
}
