import math T = int(input()) for _ in range(T): N = int(input()) A = list(map(int, input().split())) v = 1 for a in A: v = v*a if v == math.isqrt(v)**2: print('Yes') else: print('No')