Problem2326--Everything Everywhere All But One

2326: Everything Everywhere All But One

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MB

Description

You are given an array of nn integers a1,a2,…,ana1,a2,…,an. After you watched the amazing film "Everything Everywhere All At Once", you came up with the following operation.

In one operation, you choose n−1n−1 elements of the array and replace each of them with their arithmetic mean (which doesn't have to be an integer). For example, from the array [1,2,3,1][1,2,3,1] we can get the array [2,2,2,1][2,2,2,1], if we choose the first three elements, or we can get the array [43,43,3,43][43,43,3,43], if we choose all elements except the third.

Is it possible to make all elements of the array equal by performing a finite number of such operations?

Input

The first line of the input contains a single integer tt (1≤t≤2001≤t≤200)  — the number of test cases. The description of the test cases follows.

The first line of each test case contains a single integer nn (3≤n≤503≤n≤50)  — the number of integers.

The second line of each test case contains nn integers a1,a2,…,ana1,a2,…,an (0≤ai≤1000≤ai≤100).

Output

For each test case, if it is possible to make all elements equal after some number of operations, output YESYES. Otherwise, output NONO.

You can output YESYES and NONO in any case (for example, strings yEsyEsyesyesYesYes will be recognized as a positive response).

Sample Input Copy

4
3
42 42 42
5
1 2 3 4 5
4
4 3 2 1
3
24 2 22

Sample Output Copy

YES
YES
NO
NO

HINT

In the first test case, all elements are already equal.

In the second test case, you can choose all elements except the third, their average is 1+2+4+54=31+2+4+54=3, so the array will become [3,3,3,3,3][3,3,3,3,3].

It's possible to show that it's impossible to make all elements equal in the third and fourth test cases.

Source/Category