Sherlock is stuck while solving a problem: Given an array $A=\{a_1,a_2,\cdots,a_N\}$, he wants to know if there exists a subset $\mbox{B}$ of this array which follows these statements:

$\mbox{B}$ is a non-empty subset.
There exists no integer $x(x>1)$ which divides all elements of $\mbox{B}$.
There are no elements of $\mbox{B}$ which are equal to another.

Input Format

The first line of input contains an integer, $\mathbf{T}$, representing the number of test cases. Then $\mathbf{T}$ test cases follow. 

Each test case consists of two lines. The first line contains an integer, $N$, representing the size of array $\mbox{A}$. In the second line there are $N$ space-separated integers, $a_1,a_2,\ldots,a_n$, representing the elements of array $\mbox{A}$.

Constraints 

$1\leq T\leq10$ 

$1\leq N\leq100$ 

$1\leq a_i\leq10^5\:\forall1\leq i\leq N$   

Output Format

Print YES if such a subset exists; otherwise, print NO.

Sample Input
3
3
1 2 3
2
2 4
3
5 5 5

Sample Output
YES
NO
NO

Explanation

In the first test case, $\{1\},\{2\},\{3\},\{1,2\},\{1,3\},\{2,3\}\ \text{and}\ \{1,2,3\}$ are all the possible non-empty subsets, of which the first and the last four satisfy the given condition.

For the second test case, all possible subsets are $\{2\},\{4\},\{2,4\}$. For all of these subsets, $x=2$ divides each element. Therefore, no non-empty subset exists which satisfies the given condition.

For the third test case, the following subsets exist: $\mbox{S}$_{1}$=\{5\},S$_{2}$=\{5,5\},\:\text{and}\:S$_{3}$=\{5,5,5\}$. 
Because the single element in the first subset is divisible by $5$ and the other two subsets have elements that are equal to another, there is no subset that satisfies every condition.

Difficulty: EASY

Solutions:
def gcd(a, b):
	while b:
		a %= b
		(a, b) = (b, a)
	return a
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	res = a[0]
	for i in range(1, n):
		res = gcd(res, a[i])
	print('YES' if res == 1 else 'NO')


def gcd(testlist):
	if len(testlist) == 1:
		return testlist[0]
	while len(testlist) > 1:
		a = testlist[len(testlist) - 2]
		b = testlist[len(testlist) - 1]
		testlist = testlist[:len(testlist) - 2]
		while a:
			(a, b) = (b % a, a)
		testlist.append(b)
	return abs(b)
maxval = int(input())
for i in range(0, maxval):
	val = int(input())
	vallist = list(map(int, input().split()))
	val = gcd(vallist)
	if val == 1:
		print('YES')
	else:
		print('NO')


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
T = int(input())
for _ in range(T):
	n = int(input())
	a = [int(i) for i in input().split()]
	g = a[0]
	for i in a:
		g = gcd(g, i)
	if g == 1:
		print('YES')
	else:
		print('NO')


def gcd(a, b):
	if a > b:
		(a, b) = (b, a)
	while a > 0:
		(a, b) = (b % a, a)
	return b
T = int(input())
for _ in range(T):
	N = int(input())
	A = [int(_) for _ in input().split()]
	d = A[0]
	for a in A:
		d = gcd(d, a)
	if d == 1:
		print('YES')
	else:
		print('NO')


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def gcdapp(arr, ind):
	if len(arr) == 1:
		if arr[ind] == 1:
			return 1
		else:
			return 0
	elif ind == len(arr) - 2:
		return gcd(arr[ind], arr[ind + 1])
	return gcd(arr[ind], gcdapp(arr, ind + 1))
testcase = int(input())
for x in range(testcase):
	size = int(input())
	arr = [int(x) for x in input().strip().split(' ')]
	if gcdapp(arr, 0) == 1:
		print('YES')
	else:
		print('NO')


def gcd_num(x, y):
	if x % y is 0:
		return y
	else:
		return gcd_num(y, x % y)

def gcd(array):
	length = len(array)
	if length > 2:
		return gcd_num(gcd(array[:length // 2]), gcd(array[length // 2:]))
	elif length == 1:
		return array[0]
	else:
		return gcd_num(array[0], array[1])
test = int(input())
while test:
	test = test - 1
	n = int(input())
	array = [int(x) for x in input().strip().split(' ')]
	if len(array) == 1:
		print('NO')
		continue
	v = gcd(array)
	if v == 1:
		print('YES')
	else:
		print('NO')


import itertools

def gcd(iterable):
	nums = tuple(iterable)
	if len(nums) == 0:
		return None
	while len(nums) > 1:
		d = min(nums)
		nums = (d,) + tuple((m for m in (n % d for n in nums) if m != 0))
	return nums[0]

def sherlock(iterable):
	return gcd(iterable) == 1
T = int(input())
for i in range(T):
	N = int(input())
	arr = tuple((int(n) for n in input().strip().split()))
	print('YES' if sherlock(arr) else 'NO')


def gcd(a, b):
	if b == 0:
		return a
	elif a < b:
		return gcd(b, a)
	else:
		return gcd(a % b, b)
import math
test = int(input())
for i in range(test):
	nu = int(input())
	l = input()
	q = l.split(' ')
	g = 1
	gcf = int(q[0])
	for i in range(len(q) - 1):
		gcf = gcd(gcf, int(q[i + 1]))
		if gcf == 1:
			g = 0
			break
	if g == 0:
		print('YES')
	else:
		print('NO')


import functools

def GCD(a, b):
	a = abs(a)
	b = abs(b)
	while a:
		(a, b) = (b % a, a)
	return b

def GCD_List(arr):
	return functools.reduce(GCD, arr)
for t in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	if GCD_List(a) == 1:
		print('YES')
	else:
		print('NO')


T = int(input())
import itertools

def gcd(a, b):
	if a == 1 or b == 1:
		return 1
	if a < b:
		(a, b) = (b, a)
	a = a % b
	if not a:
		return b
	return gcd(a, b)
for line in range(T):
	N = int(input())
	A = [int(x) for x in input().split()]
	found = False
	for (c1, c2) in itertools.combinations(range(N), 2):
		if gcd(A[c1], A[c2]) == 1:
			print('YES')
			found = True
			break
	if not found:
		print('NO')


def gcd2(a, b):
	(a, b) = (min(a, b), max(a, b))
	if a == 0:
		return b
	else:
		return gcd2(a, b % a)

def gcd(l):
	if len(l) == 1:
		return l[0]
	else:
		return gcd([gcd2(l[0], l[1])] + l[2:])
T = int(input())
for i in range(T):
	input()
	l = input().split(' ')
	l = [int(i) for i in l]
	if gcd(l) == 1:
		print('YES')
	else:
		print('NO')


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))
	result = a[0]
	iter = 1
	while iter < len(a):
		result = gcd(result, a[iter])
		iter = iter + 1
	if result == 1:
		print('YES')
	else:
		print('NO')
	t = t - 1


def gcd(a, b):
	while b != 0:
		(a, b) = (b, a % b)
	return a
T = int(input())
for q in range(T):
	N = int(input())
	A = [int(i) for i in input().split(' ')]
	res = A[0]
	for x in A:
		res = gcd(x, res)
	if res == 1:
		print('YES')
	else:
		print('NO')


from itertools import combinations

def gcd(a, b):
	while a != b:
		if a > b:
			a -= b
		if b > a:
			b -= a
	return a
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	combos = list(combinations(l, 2))
	ans = 'NO'
	for j in combos:
		x = max(j)
		y = min(j)
		if gcd(x, y) == 1:
			ans = 'YES'
			break
	print(ans)


T = int(input())

def gcd(a, b):
	if b > a:
		return gcd(b, a)
	if b == 0:
		return a
	return gcd(b, a % b)

def solve(lst):
	for i in range(len(lst)):
		for j in range(i + 1, len(lst)):
			if gcd(lst[i], lst[j]) == 1:
				return 'YES'
	return 'NO'
for _ in range(T):
	input()
	lst = list(map(int, input().split()))
	print(solve(lst))


def gcd_binaire(x, y):
	if x < y:
		(x, y) = (x, y)
	while y != 0:
		tm = x % y
		x = y
		y = tm
	return x

def gcd(tmp):
	if len(tmp) == 1:
		return tmp[0]
	if len(tmp) == 2:
		return gcd_binaire(tmp[0], tmp[1])
	h = int(len(tmp) / 2)
	return gcd_binaire(gcd(tmp[0:h]), gcd(tmp[h:len(tmp)]))

def compute_subS(lst):
	if len(lst) < 1:
		print('NO')
		return
	elif len(lst) == 1:
		if lst[0] == 1:
			print('YES')
		else:
			print('NO')
		return
	res = gcd(lst)
	if res == 1:
		print('YES')
	else:
		print('NO')
	return
t = int(input())
for i in range(t):
	N = int(input())
	lst = input().split()
	for k in range(len(lst)):
		lst[k] = int(lst[k])
	compute_subS(lst)


import itertools

def gcd(a, b):
	if a < b:
		return gcd(b, a)
	if b == 0:
		return a
	return gcd(b, a % b)
T = int(input())
for _ in range(T):
	N = int(input())
	A = [int(i) for i in input().split()]
	if any((gcd(a, b) == 1 for (a, b) in itertools.combinations(A, 2))):
		print('YES')
	else:
		print('NO')


def GCD(x, y):
	if x < y:
		(x, y) = (y, x)
	if x % y == 0:
		return y
	return GCD(x % y, y)

def arrayGCD(ar):
	ar = sorted(list(set(ar)))
	if len(ar) == 1:
		return ar[0]
	result = ar[0]
	for i in range(1, len(ar)):
		if result == 1:
			return result
		result = GCD(result, ar[i])
	return result

def runner():
	t = int(input())
	for i in range(0, t):
		size = int(input())
		s = input()
		s = s.split(' ')
		nums = []
		for n in s:
			nums += [int(n)]
		numsGCD = arrayGCD(nums)
		if numsGCD == 1:
			print('YES')
		else:
			print('NO')
runner()


__author__ = 'danielbaeck'
import math
import itertools

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
t = int(input())
for i in range(t):
	n = int(input())
	gc = 0
	numbers = [int(x) for x in input().split(' ')]
	for x in numbers:
		gc = gcd(gc, x)
	if gc == 1:
		print('YES')
	else:
		print('NO')


def gcd(a, b):
	while a != b:
		if a > b:
			a = a - b
		else:
			b = b - a
	return a
T = int(input())
for i in range(T):
	N = int(input())
	array = input().split(' ')
	flag = 0
	g = int(array[0])
	for j in range(1, len(array)):
		n1 = g
		n2 = int(array[j])
		g = gcd(n1, n2)
		if g == 1:
			flag = 1
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


def gcd(a, b):
	while 0 < b:
		(a, b) = (b, a % b)
	return a
T = int(input())
yes = 'YES'
no = 'NO'
for t in range(T):
	N = int(input())
	A = [int(s) for s in input().split()]
	if 1 in A:
		print(yes)
		continue
	found = False
	for i in range(N - 1):
		if found:
			break
		for j in range(i + 1, N):
			if gcd(A[j], A[i]) == 1:
				found = True
	if found:
		print(yes)
	else:
		print(no)


def GCD(a, b):
	while b != 0:
		(a, b) = (b, a % b)
	return a

def calGcdOfList(alist):
	length = len(alist)
	if length == 1:
		return alist[0]
	gcd = GCD(alist[0], alist[1])
	for i in range(2, length):
		gcd = GCD(gcd, alist[i])
	return gcd
T = int(input())
for _ in range(T):
	N = int(input())
	alist = list(map(int, input().split()))
	if calGcdOfList(alist) == 1:
		print('YES')
	else:
		print('NO')


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
T = int(input())
for i in range(T):
	arlength = int(input())
	sarr = str(input()).split(' ')
	iarr = list()
	for m in range(arlength):
		iarr.append(int(sarr[m]))
	count = 0
	n = 0
	for k in range(arlength):
		if iarr[k] != 1:
			for l in range(k, arlength):
				if gcd(iarr[l], iarr[k]) == 1:
					n = 1
					print('YES')
					break
		if n == 1:
			break
	if n == 0:
		print('NO')


def gcd(a, b):
	if a % b == 0:
		return b
	elif a < b:
		return gcd(b, a)
	else:
		return gcd(b, min(a % b, a - a % b))

def func(A):
	rt = A[0]
	for i in A:
		rt = gcd(rt, i)
		if rt == 1:
			return 'YES'
	return 'NO'
for i in range(int(input())):
	input()
	print(func([int(i) for i in input().split()]))


def gcd(a, b):
	if a % b == 0:
		return b
	else:
		return gcd(b, a % b)
test = int(input())
for t in range(test):
	n = int(input())
	a = list(map(int, input().split()))
	j = a[0]
	val = False
	for i in a:
		j = gcd(j, i)
		if j == 1:
			val = True
			break
	if val:
		print('YES')
	else:
		print('NO')


def gcd(a, b):
	if a != 0 and b != 0:
		return gcd(b, a % b)
	else:
		return a + b
testCases = int(input())
for _ in range(testCases):
	N = int(input())
	array = [int(elem) for elem in input().split()]
	try:
		for index_1 in range(N):
			for index_2 in range(index_1 + 1, N):
				if gcd(array[index_1], array[index_2]) == 1:
					print('YES')
					raise TypeError
	except TypeError:
		continue
	print('NO')


import functools

def gcd(a, b):
	while b != 0:
		(a, b) = (b, a % b)
	return a
for _ in range(int(input())):
	N = int(input())
	Array = list(map(int, input().split()))
	if functools.reduce(gcd, list(map(int, Array))) == 1:
		print('YES')
	else:
		print('NO')


def gcd(a: int, b: int):
	if b == 0:
		return a
	return gcd(b, a % b)
T = int(input())
for i in range(T):
	N = int(input())
	A = [int(x) for x in input().split(' ')]
	my_gcd = 0
	for x in A:
		my_gcd = gcd(my_gcd, x)
	if my_gcd == 1:
		print('YES')
	else:
		print('NO')


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
cases = int(input())
for i in range(cases):
	size = int(input())
	arr = [int(i) for i in input().split()]
	gc = 0
	for val in arr:
		gc = gcd(val, gc)
	if gc == 1:
		print('YES')
	else:
		print('NO')


T = int(input())
for i in range(T):
	N = int(input())
	A = [int(nString) for nString in str(input()).split()]
	t = 0
	for number in A:
		while number != 0:
			number2 = number
			number = t % number2
			t = number2
	if t == 1:
		print('YES')
	else:
		print('NO')


def gcd(a, b):
	minN = min(a, b)
	answer = 1
	for i in range(minN):
		if a % (i + 1) == 0 and b % (i + 1) == 0:
			answer = i + 1
	return answer
T = int(input())
for blah in range(T):
	N = input()
	a = str(input()).split(' ')
	a = [int(x) for x in a]
	GCD = -1
	for j in range(len(a)):
		if GCD == -1:
			GCD = a[j]
		else:
			GCD = gcd(GCD, a[j])
	if GCD == 1:
		print('YES')
	else:
		print('NO')


def gcd(a, b):
	while b != 0:
		t = b
		b = a % b
		a = t
	return a
t = int(input())
for asdfasf in range(t):
	n = int(input())
	tab = list(map(int, input().split()))
	if n == 1 and tab[0] == 1:
		print('YES')
		continue
	for i in range(len(tab)):
		flag = False
		for j in range(i + 1, len(tab)):
			if gcd(tab[i], tab[j]) == 1:
				flag = True
				break
		if flag == True:
			break
	if flag == True:
		print('YES')
	else:
		print('NO')


def gcd(x, y):
	if x < y:
		return gcd(y, x)
	r = x % y
	if r == 0:
		return y
	return gcd(y, r)

def solve():
	l = list(map(int, input().split()))
	L = len(l)
	for i in range(0, L):
		for j in range(i + 1, L):
			if gcd(l[i], l[j]) == 1:
				return 'YES'
	return 'NO'
t = int(input())
for i in range(0, t):
	n = int(input())
	print(solve())


__author__ = 'jeffmcgraw'

def read_line():
	line_list = []
	line_string = input()
	for a in line_string.split(' '):
		b = int(a)
		line_list.append(b)
	return line_list

def test_line():
	num_tests = int(input())
	temp_string = read_line()
	test_string = sorted(temp_string)
	lineout = test_the_line(test_string)
	return lineout

def test_the_line(line_data):
	factors = []
	if 1 in line_data:
		return 'YES'
	for a in range(2, line_data[0] + 1):
		if line_data[0] % a == 0:
			factors.append(a)
	for b in line_data:
		drops = []
		for c in factors:
			if b % c != 0:
				drops.append(c)
		for d in drops:
			factors.remove(d)
		if len(factors) == 0:
			return 'YES'
	return 'NO'

def maine():
	num_tests = int(input())
	for opp_loop in range(num_tests):
		output = test_line()
		print(output)
maine()


def gcd(a, b):
	if a < b:
		t = a
		a = b
		b = t
	if 0 == a % b:
		return b
	return gcd(b, a % b)
T = int(input())
for i in range(T):
	N = int(input())
	L = list(map(int, input().split()))
	g = L[0]
	for j in range(1, len(L)):
		g = gcd(g, L[j])
	if g == 1:
		print('YES')
	else:
		print('NO')


import functools

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
T = int(input())
for i in range(T):
	N = int(input())
	res = 'NO'
	numbers = list(map(int, input().split()))
	if len(numbers) > 2:
		res = functools.reduce(lambda x, y: gcd(x, y), numbers)
	if res == 1:
		print('YES')
	else:
		print('NO')


T = int(input())

def gcd(a, b):
	if a % b == 0:
		return b
	return gcd(b, a % b)
for testCase in range(T):
	N = int(input())
	A = [int(i) for i in input().split()]
	for (ai, a) in enumerate(A):
		for b in A[ai:]:
			if gcd(a, b) == 1:
				print('YES')
				break
		else:
			continue
		break
	else:
		print('NO')


T = int(input())

def gcd(a, b):
	if a < b:
		b = a
		a = b
	while b > 0:
		t = b
		b = a % b
		a = t
	return a

def sherlock_gcd(arr):
	if 1 in arr:
		return 'YES'
	for (i, num) in enumerate(arr[:-1]):
		for (j, other_num) in enumerate(arr[i + 1:]):
			if num != other_num:
				gcd_ret = gcd(num, other_num)
				if gcd_ret == 1:
					return 'YES'
	return 'NO'
for t in range(T):
	N = int(input())
	A = [int(x) for x in str(input()).split()]
	print(sherlock_gcd(A))


import math

def sieve(n):
	m = n + 1
	rn = math.floor(math.sqrt(n)) + 1
	primes = []
	numbs = [True] * m
	numbs[0:2] = [False, False]
	for i in range(4, m, 2):
		numbs[i] = False
	for i in range(3, rn, 2):
		if numbs[i]:
			for a in range(i * i, m, i):
				numbs[a] = False
	for i in range(m):
		if numbs[i]:
			primes.append(i)
	return primes
T = int(input())
N = []
amax = 0
for i in range(T):
	_ = int(input())
	N.append([int(x) for x in input().split()])
	N[i].sort()
	if N[i][-1] > amax:
		amax = N[i][-1]
primes = sieve(amax)
for i in range(T):
	if 1 in N[i]:
		print('YES')
		continue
	common = False
	for p in primes:
		test = 0
		for n in N[i]:
			test += n % p
		if not test:
			common = True
			break
	if common:
		print('NO')
	else:
		print('YES')


def get_input():
	list_of_sets = []
	num_testcases = int(input())
	for testcase in range(num_testcases):
		size_of_array = input()
		list_of_sets.append([int(i) for i in input().split()])
	return list_of_sets

def check_subset(list_of_sets):
	for test_set in list_of_sets:
		subset_exists = 'YES'
		top_val = max(test_set)
		for i in range(2, top_val + 1):
			if len([j for j in test_set if not j % i]) == len(test_set):
				subset_exists = 'NO'
		print(subset_exists)

def run_test():
	testcases = get_input()
	check_subset(testcases)
run_test()


T = int(input())

def gcd(a, b):
	rem = a % b
	if rem == 0:
		return b
	else:
		return gcd(b, rem)

def has_nonmatch(A):
	for i in range(len(A)):
		for j in range(i + 1, len(A)):
			if gcd(A[i], A[j]) == 1:
				return 'YES'
	return 'NO'
for i in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	if A[0] == 1:
		print('YES')
	else:
		print(has_nonmatch(A))


def GCD(a, b):
	while b > 0:
		tmp = b
		b = a % b
		a = tmp
	return a
T = int(input())
for i in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	g = 0
	for j in a:
		g = GCD(g, j)
	if g == 1:
		print('YES')
	else:
		print('NO')


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
t = int(input())
while t:
	g = 0
	n = int(input())
	a = input()
	a = a.split()
	x = 0
	for j in a[x:]:
		y = x + 1
		for k in a[y:]:
			g = gcd(int(j), int(k))
		if g == 1:
			print('YES')
			break
	if g != 1:
		print('NO')
	t -= 1


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
t = int(input())
for i in range(t):
	l = int(input())
	inp1 = input().split()
	inp = [int(x) for x in inp1]
	j = 0
	k = 0
	task = ''
	while k < l:
		while j < l and j != k:
			if gcd(inp[j], inp[k]) == 1:
				print('YES')
				task = 'done'
				break
			j += 1
		if task == 'done':
			break
		k += 1
	if task != 'done':
		print('NO')


from sys import stdin
from math import sqrt
cases_count = int(stdin.readline())
for case_number in range(cases_count):
	set_size = int(stdin.readline())
	elements = list(map(int, stdin.readline().split()))
	element_max = max(elements)
	divisor_max = element_max
	if 1 in elements:
		print('YES')
		continue
	for divisor in range(2, divisor_max + 1):
		elements_trial = list(filter(lambda i: i % divisor, elements))
		if 0 == len(elements_trial):
			print('NO')
			break
	else:
		print('YES')


def hasSubset(n):
	sub = []
	d = None
	for a in n:
		sub.append(a)
		if d == None:
			d = []
			for i in range(a, 1, -1):
				if a % i == 0:
					d.append(i)
		else:
			for i in d:
				if a % i != 0:
					d.remove(i)
	return len(d) == 0
t = int(input())
for _ in range(t):
	input()
	n = [int(x) for x in input().split()]
	print('YES' if hasSubset(n) else 'NO')


import math
import sys

def checkforgcd(A, B):
	for k in range(2, 50):
		if (A % k == 0) & (B % k == 0):
			return 1
	return 0
T = int(input())
for i in range(T):
	N = int(input())
	A = str(input()).split()
	A = list(A)
	B = [0] * N
	for i in range(N):
		B[i] = int(A[i])
	B = sorted(B)
	gcd = B[0]
	for i in range(N):
		if gcd == 1:
			print('YES')
			break
		elif checkforgcd(B[i], gcd) == 1:
			pass
		elif B[i] % gcd != 0:
			print('YES')
			break
		if i == N - 1:
			print('NO')


def get_gcd(a, b):
	if a % b == 0:
		return b
	else:
		return get_gcd(b, a % b)
T = int(input())
for test in range(T):
	N = int(input())
	A = [int(x) for x in input().split()]
	gcd = A[0]
	for el in A[1:]:
		gcd = get_gcd(gcd, el)
	if gcd == 1:
		print('YES')
	else:
		print('NO')


from functools import reduce

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
for case in range(int(input())):
	input()
	A = map(int, input().split())
	result = reduce(gcd, A) == 1
	print('YES' if result else 'NO')


from functools import reduce

def gcd(a, b):
	if a == 0:
		return b
	else:
		return gcd(b % a, a)
inputs = int(input())
for _ in range(inputs):
	input()
	x = [int(x) for x in input().split(' ')]
	if reduce(gcd, x) == 1:
		print('YES')
	else:
		print('NO')


def all_divisors(n):
	div = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			div += [i, n // i]
	return set(div)

def sherlock(a):
	a = sorted(a)
	divisors = all_divisors(a[0])
	for i in a[1:]:
		divisors = divisors.intersection(all_divisors(i))
		if len(divisors) == 1:
			return True
	return False
T = int(input())
for _ in range(T):
	N = int(input())
	a = [int(x) for x in input().split()]
	if sherlock(a):
		print('YES')
	else:
		print('NO')


def if_exists(A):
	for divisor in range(2, min(A) + 1):
		if not sum([x % divisor for x in A]):
			print('NO')
			return
	print('YES')
for i in range(int(input())):
	input()
	A = list(map(int, input().split(' ')))
	if_exists(A)


T = int(input())
for case_i in range(T):
	N = int(input())
	A = input().split()
	state = []
	for x in range(2, 100000):
		state.append(all((int(i) % x == 0 for i in A)))
	if any(state) == True:
		print('NO')
	else:
		print('YES')


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def gcdl(lst):
	res = 0
	for el in lst:
		res = gcd(res, el)
	return res
t = int(input())
for i in range(t):
	n = input()
	lst = list(map(int, input().split()))
	if gcdl(lst) == 1:
		print('YES')
	else:
		print('NO')


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
t = int(input())
for k in range(t):
	n = int(input())
	a = [int(item) for item in input().strip().split()]
	flag = False
	for i in range(n):
		for j in range(i, n):
			if gcd(a[i], a[j]) == 1:
				flag = True
				break
		if flag:
			break
	if flag:
		print('YES')
	else:
		print('NO')


def gcd(a, b):
	if a < b:
		return gcd(b, a)
	a = a % b
	if a == 0:
		return b
	return gcd(b, a)

def check_arr(arr):
	if len(arr) == 1:
		if arr[0] == 1:
			return True
		else:
			return False
	elif gcd(arr[0], arr[1]) == 1:
		return True
	else:
		return False

def solve(input_list):
	acc = []
	for j in range(len(input_list)):
		acc.append(input_list[j])
		if check_arr(acc):
			return True
		for t in range(j + 1, len(input_list)):
			acc.append(input_list[t])
			if check_arr(acc):
				return True
			else:
				acc.pop()
		acc.clear()
	return False
no_of_test_cases = int(input())
for i in range(no_of_test_cases):
	no_of_elements = int(input())
	elements = list(map(lambda x: int(x), input().split()))
	if solve(elements):
		print('YES')
	else:
		print('NO')


def gcd(a, b):
	if a == 1 or b == 1:
		return 1
	if a < b:
		temp = a
		a = b
		b = temp
	for w in range(b):
		temp = b - w
		if b % temp == 0 and a % temp == 0:
			return temp
for qwop in range(int(input())):
	input()
	nums = list(map(int, input().split()))
	val = False
	l = len(nums)
	while l > 1:
		temp = gcd(nums[0], nums[1])
		del nums[0]
		del nums[0]
		nums.append(temp)
		l = l - 1
	if nums[0] == 1:
		print('YES')
	else:
		print('NO')