#include <bits/stdc++.h>
#define maxn 1000005
using namespace std;
mt19937 rnd(std::chrono::system_clock::now().time_since_epoch().count());
int t, n, a[maxn];
signed main() {
cin >> t;
bool f = 0;
while (t--) {
f = 1;
int cnt = 0;
cin >> n; for (int i = 1; i <= n; i++)
cin >> a[i], cnt += a[i]; if (cnt % n != 0) {if (f) cout << "No\n", f = 0; continue;}
cnt /= n; for (int i = 1; i <= n; i++) {a[i] -= cnt; if (a[i] == 0) {if (f) cout << "Yes\n", f = 0; break;}}
int ppp = 125; while (ppp--) {
shuffle(a + 1, a + 1 + n, rnd); int zzl = 0;
for (int i = 1; i <= n; i++) {
zzl += a[i];
if (zzl == 0 && i != n) {if (f) cout << "Yes\n", f = 0; break;}
}
} if (f) cout << "No\n";
}
return 0;
}
我就 shuffle 了一下嘛