n=int(input())
for i in range(n):
    m=int(input())
    x=input().split()
    x=[int(i) for i in x]
    x.sort()
    x=x[::2]
    y=x[::-1]
    z=[]
    for i in range(len(x)//2):
        z.append(x[i]*y[i])
    if len(set(z))==1:
        print('YES')
    else:
        print('NO')