from math import gcd t = int(input()) for i in range(t): n = int(input()) a = list(map(int,input().split())) now = 1 for i in range(n): g = gcd(now, a[i]) now = (now//g)*(a[i]//g) sq = int(pow(now,0.5)) for i in range(min(0, sq-5), sq+5): if sq ** 2 == now: now = 1 if now == 1: print('Yes') else: print('No')