def is_square(apositiveint): x = apositiveint // 2 seen = set([x]) while x * x != apositiveint: x = (x + (apositiveint // x)) // 2 if x in seen: return False seen.add(x) return True t = int(input()) for i in range(t): n = int(input()) a = list(map(int, input().split())) mul = 1 for e in a: mul *= e if is_square(mul): print("Yes") else: print("No")