import sys
k = int(input())
for i in range(k):
n = int(input())
# 因为只能同步加减一次,说明数字的种类不能超过三种,超过三种无法满足一次
a = sorted(list(set(list(map(int,input().split())))))
if len(a)<3:
print('YES')
elif len(a)==3 and a[1]-a[0]==a[2]-a[1]:
print('YES')
else:
print('NO')

京公网安备 11010502036488号