T=int(input()) import math for _ in range(T): N=int(input()) A=[int(x) for x in input().split()] A.sort() for i in range(N): for j in range(i+1,N): a=math.gcd(A[i],A[j]) A[i]//=a A[j]//=a flag=True for i in range(N): t=int((A[i])**0.5) if t**2!=A[i] and (t+1)**2!=A[i]: print("No") flag=False break if flag: print("Yes")