#include using namespace std; using i64 = int64_t; #define _for(i, l, r, vals...) \ for (decltype(l + r) i = (l), i##end = (r), ##vals; i <= i##end; ++i) template bool chkmin(T &a, T b) { return b < a ? a = b, true : false; } template bool chkmax(T &a, T b) { return a < b ? a = b, true : false; } const uint32_t OFFSET = 5; const uint32_t N = 1e5 + OFFSET, M = 2e5 + OFFSET, K = 21; int a[N]; auto solve() -> void { int n; cin >> n; i64 sum = 0; _for(i, 1, n) { cin >> a[i]; sum += a[i]; } cout << (sum % n == 0 && any_of(a + 1, a + n + 1, [sum, n](int x) { return x == sum / n; }) ? "YES" : "NO") << '\n'; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int _t; cin >> _t; while (_t--) solve(); return 0; }