#SL2310L. Equalize the Array
Equalize the Array
Equalize the Array
You are given an array consisting of integers.
In one move, you can choose a positive integer , such that is one of the modes of the array, then add to each in .
An integer is a mode of an array if and only if appears most frequently in . Note that an array may have multiple modes (e.g. are both the modes of ).
Find out if it is possible to get an array that all elements in it are equal through several (possibly zero) such moves.
Input
The first line contains a single integer , denoting the number of test cases.
For each test case, the first line contains an integer .
The next line contains integers. The -th number denotes .
It is guaranteed that the sum of over all test cases does not exceed .
Output
For each test case, output a string. If it is possible, output YES
; otherwise, output NO
.
Example
3
5
1 2 3 4 5
5
4 4 1 4 4
4
2 2 2 2
YES
NO
YES