from math import isqrt t = int(input()) for _ in range(t): n = int(input()) a = list(map(int, input().split())) p = 1 for v in a: p *= v rt = isqrt(p) print("Yes" if rt**2 == p else "No")