import math t = int(input()) for _ in range(t): n = int(input()) a = list(map(int, input().split())) p = math.prod(a) rt = round(math.sqrt(p)) print("Yes" if rt * rt == p else "No")