import sys, random input = lambda : sys.stdin.readline().rstrip() write = lambda x: sys.stdout.write(x+"\n"); writef = lambda x: print("{:.12f}".format(x)) debug = lambda x: sys.stderr.write(x+"\n") YES="Yes"; NO="No"; pans = lambda v: print(YES if v else NO); INF=10**18 LI = lambda : list(map(int, input().split())); II=lambda : int(input()) def debug(_l_): for s in _l_.split(): print(f"{s}={eval(s)}", end=" ") print() def dlist(*l, fill=0): if len(l)==1: return [fill]*l[0] ll = l[1:] return [dlist(*ll, fill=fill) for _ in range(l[0])] def isqrt(n): """x*x<=nなる最大のx """ x,y = n, (n+1)//2 while y1: return rho(g) def factor(n): """高速な素因数分解 """ if n==1: return {} f = is_prime(n) if f: return {n:1} ans = {} while n%2==0: ans.setdefault(2, 0) ans[2] += 1 n //= 2 v = rho(n) while v!=n and n>1: ans.setdefault(v, 0) while n%v==0: n //= v ans[v] += 1 if n>3 and is_prime(n): ans.setdefault(n,0) ans[n] += 1 return ans v = rho(n) if n>1: ans.setdefault(n, 0) ans[n] += 1 return ans t = II() for _ in range(t): n = int(input()) a = list(map(int, input().split())) d = {} for val in a: f = factor(val) for k,v in f.items(): d.setdefault(k, 0) d[k] += v pans(all((v%2==0 for v in d.values())))