import math from queue import Queue def solve() : N = int(input()) A = list(map(int, input().split())) que = Queue() for a in A : que.put(a) for i in range(N-1) : a = que.get() b = que.get() que.put(a * b) ret = que.get() pk = math.sqrt(ret) pk -= 5 while pk * pk < ret : pk += 1 if pk * pk == ret : print("Yes") else : print("No") T = int(input()) for i in range(T) : solve()