#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int t;
  for (cin >> t; t--;) {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    bool gd = true;
    int time = 0;
    for (int i = 1; i < n; i++) {
      if ((a[0] - a[i]) % 2 != 0) {
        gd = false;
        break;
      }
      int rem = a[i] - time;
      int need = (a[i] - a[0]) / 2;
      if (need > rem) {
        gd = false;
        break;
      }
      time += need;
    }
    if (gd) {
      cout << "YES";
    } else {
      cout << "NO";
    }
    cout << "\n";
  }
  return 0;
}
