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(now**0.5) if sq**2 == now: now = 1 if now == 1: print('Yes') else: print('No')