#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int col;
    cin >> col;
    int a[col], small = 101;
    for (int i = 0; i < col; ++i) {
      cin >> a[i];
      small = min(small, a[i]);
    }
    for (int i = 0; i < col; ++i) {
      a[i] -= small;
    }
    bool flag = true;
    for (int i = 0; i < col; ++i) {
      if (a[i] % 2 != 0) {
        flag = false;
        break;
      }
    }
    if (flag) {
      cout << "YES\n";
    } else
      cout << "NO\n";
  }
  return 0;
}
