You are given an array of $n$ non-negative integers $a_1, a_2, \ldots, a_n$. You can make the following operation: choose an integer $x \geq 2$ and replace each number of the array by the remainder when dividing that number by $x$, that is, for all $1 \leq i \leq n$ set $a_i$ to $a_i mod x$.

Determine if it is possible to make all the elements of the array equal by applying the operation zero or more times.


-----Input-----

The input consists of multiple test cases. The first line contains a single integer $t$ ($1 \leq t \leq 10^4$) — the number of test cases. Description of the test cases follows.

The first line of each test case contains an integer $n$ ($1 \leq n \leq 10^5$) — the length of the array.

The second line of each test case contains $n$ integers $a_1, a_2, \ldots, a_n$ ($0 \leq a_i \leq 10^9$) where $a_i$ is the $i$-th element of the array.

The sum of $n$ for all test cases is at most $2 \cdot 10^5$.


-----Output-----

For each test case, print a line with YES if you can make all elements of the list equal by applying the operation. Otherwise, print NO.

You may print each letter in any case (for example, "YES", "Yes", "yes", "yEs" will all be recognized as a positive answer).


-----Examples-----

Input
4
4
2 5 6 8
3
1 1 1
5
4 1 7 0 8
4
5 9 17 5
Output
YES
YES
NO
YES


-----Note-----

In the first test case, one can apply the operation with $x = 3$ to obtain the array $[2, 2, 0, 2]$, and then apply the operation with $x = 2$ to obtain $[0, 0, 0, 0]$.

In the second test case, all numbers are already equal.

In the fourth test case, applying the operation with $x = 4$ results in the array $[1, 1, 1, 1]$.

Difficulty: EASY

Solutions:
for s in [*open(0)][2::2]:
	a = {*map(int, s.split())}
	if 1 not in a:
		print('YES')
	elif all((x - 1 not in a for x in a)):
		print('YES')
	else:
		print('NO')


import sys
getline = sys.stdin.readline

def read_int():
	return int(getline())

def read_ints():
	return list(map(int, getline().split()))

def read_s():
	return str(getline().strip())

def read_ss():
	return list(map(str, getline().strip().split()))
t = read_int()
for _ in range(t):
	n = read_int()
	S = set(read_ints())
	ans = 1
	if 1 in S:
		if 0 in S:
			ans = 0
		else:
			for a in S:
				if a - 1 in S:
					ans = 0
					break
	if ans:
		print('YES')
	else:
		print('NO')


def equal_mod(a):
	if 0 in a:
		if 1 in a:
			return 0
		else:
			return 1
	elif 1 not in a:
		return 1
	else:
		for i in a:
			if i + 1 in a:
				return 0
		return 1
T = int(input())
for i in range(T):
	n = int(input())
	a = set(map(int, input().split()))
	result = equal_mod(a)
	if result == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	for i in l:
		d[i] = 1
	if 0 in d and 1 in d:
		print('NO')
	elif 0 in d:
		print('YES')
	elif 1 in d:
		flag = 0
		for i in l:
			if i - 1 in d:
				flag = 1
				break
		if flag == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('YES')


def makeequalwithmod(nums):
	flag = False
	if 0 in nums:
		flag = True
	flag1 = False
	if 1 in nums:
		flag1 = True
	if flag and flag1:
		return False
	if flag1:
		numset = set(nums)
		for x in nums:
			if x - 1 in numset or x + 1 in numset:
				return False
	return True
t = int(input())
for _ in range(t):
	_ = input()
	nums = [int(x) for x in input().split()]
	if makeequalwithmod(nums):
		print('YES')
	else:
		print('NO')


def main():
	t = int(input())
	for _ in range(t):
		input()
		arr = {int(c) for c in input().split(' ')}
		if 1 in arr:
			flag = True
			for num in arr:
				if num - 1 in arr:
					print('NO')
					flag = False
					break
			if flag:
				print('YES')
		else:
			print('YES')
main()


x = int(input().strip())
for i in range(x):
	input()
	a = set(list(map(int, input().strip().split())))
	if 1 not in a:
		print('YES')
	else:
		for i in a:
			if i + 1 in a:
				print('NO')
				break
		else:
			print('YES')


from collections import defaultdict as dd

def AbhiSolveKiya(n, a):
	d = dd(int)
	for i in a:
		d[i] = 1
	if d[1]:
		for i in a:
			if d[i + 1] == 1:
				return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(AbhiSolveKiya(n, a))


def findPair(arr, n):
	if 1 in arr:
		for i in range(n - 1, 0, -1):
			if arr[i - 1] == arr[i] - 1:
				return False
		return True
	else:
		return True
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	print('YES' if findPair(arr, n) else 'NO')


for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	lst.sort()
	zro = dff = one = 0
	prev = lst[0]
	for x in lst:
		if x == 1:
			one = 1
		if x == 0:
			zro = 1
		if abs(x - prev) == 1:
			dff = 1
			break
		prev = x
	if one and dff or (one and zro):
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	x = set(l)
	flag = 0
	if 0 in x and 1 in x:
		print('NO')
	elif 0 in x and 1 not in x:
		print('YES')
	elif 0 not in x and 1 in x:
		for j in x:
			if j - 1 in x:
				flag = 1
				print('NO')
				break
		if flag == 0:
			print('YES')
	else:
		print('YES')


import sys
import math
from sys import stdin, stdout

def get_ints_in_variables():
	return map(int, sys.stdin.readline().strip().split())

def get_int():
	return int(input())

def get_ints_in_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_list_of_list(n):
	return [list(map(int, sys.stdin.readline().strip().split())) for _ in range(n)]

def get_string():
	return sys.stdin.readline().strip()

def main():
	for t in range(get_int()):
		n = int(input())
		arr = get_ints_in_list()
		mp = {}
		for i in range(0, n):
			mp[arr[i]] = True
		if 1 not in mp:
			print('YES')
			continue
		if 1 in mp and 0 not in mp:
			flag = True
			for i in range(0, n):
				if arr[i] + 1 in mp:
					flag = False
					break
			if flag:
				print('YES')
			else:
				print('NO')
			continue
		if 1 in mp and 0 in mp:
			print('NO')
main()


def check(n, a):
	if a.count(1) == n:
		return 'YES'
	if a.count(1) == 0:
		return 'YES'
	else:
		a.sort()
		for i in range(1, n):
			if abs(a[i] - a[i - 1]) == 1:
				return 'NO'
		return 'YES'
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(check(n, a))


def s():
	n = int(input())
	a = [int(x) for x in input().split()]
	if 1 not in a:
		print('YES')
		return
	a.sort()
	for i in range(n - 1):
		if a[i] + 1 == a[i + 1]:
			print('NO')
			return
	print('YES')
for _ in range(int(input())):
	s()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l = sorted(l)
	ans = 'YES'
	if 1 in l:
		for i in range(0, n - 1):
			if l[i + 1] == l[i] + 1:
				ans = 'NO'
				break
	print(ans)


for t in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	if 1 in l:
		for i in range(0, n - 1):
			if l[i + 1] - l[i] == 1:
				print('NO')
				break
		else:
			print('YES')
	else:
		print('YES')


def sol(n, l):
	l.sort()
	if l[0] == 0:
		for i in range(n):
			if l[i] == 1:
				return 'NO'
		return 'YES'
	elif l[0] >= 2:
		return 'YES'
	else:
		for i in range(n - 1):
			if l[i + 1] - l[i] == 1:
				return 'NO'
		return 'YES'
t = int(input())
for ii in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	print(sol(n, l))


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	s = set(arr)
	possible = True
	if 1 in s:
		for el in arr:
			if el + 1 in s:
				possible = False
				break
	print('YES' if possible else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ans = False
	cons = False
	if a.count(1) > 0:
		ans = True
	a.sort()
	for j in range(1, n):
		if a[j] - a[j - 1] == 1:
			cons = True
			break
	if ans and cons:
		print('NO')
	else:
		print('YES')


def make_equal(a):
	if 1 not in a:
		print('YES')
	elif 1 in a and 0 in a:
		print('NO')
	elif 1 in a and 2 in a:
		print('NO')
	else:
		for x in a:
			if x - 1 not in a:
				continue
			else:
				print('NO')
				return
		print('YES')
t = int(input())
for _ in range(t):
	n = int(input())
	a = {int(i) for i in input().split()}
	make_equal(a)


t = int(input())
for _ in range(t):
	n = int(input())
	L = list(map(int, input().split()))
	L.sort()
	if 1 not in L:
		print('YES')
		continue
	f = 0
	for i in range(n - 1):
		if L[i + 1] - L[i] == 1:
			print('NO')
			f = 1
			break
	if f:
		pass
	else:
		print('YES')


T = int(input())
for i in range(T):
	n = int(input())
	s = list(map(int, input().split(' ')))
	if 1 not in s:
		print('YES')
	elif max(s) == min(s) == 1:
		print('YES')
	else:
		s.sort()
		for (c, d) in zip(s[:-1], s[1:]):
			if c + 1 == d:
				print('NO')
				break
		else:
			print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	contain_0_2 = False
	contain_1 = False
	for item in a:
		if item == 0 or item == 2:
			contain_0_2 = True
			break
	for item in a:
		if item == 1:
			contain_1 = True
			break
	if contain_0_2 and contain_1:
		print('NO')
		continue
	if not contain_1:
		print('YES')
		continue
	s = set(a)
	contains_nei = False
	for item in a:
		if item - 1 in s:
			contains_nei = True
			break
	if contains_nei:
		print('NO')
	else:
		print('YES')


def answer():
	t = int(input())
	for i in range(t):
		n = int(input())
		arr = list(map(int, input().split()))
		ans = 1
		if (arr.count(0) and arr.count(1)) > 0:
			ans = 0
		elif arr.count(1) > 0:
			arr.sort()
			for j in range(1, len(arr)):
				if arr[j] - arr[j - 1] == 1:
					ans = 0
					break
		if ans == 0:
			print('NO')
		else:
			print('YES')
answer()


import sys
input = sys.stdin.readline
for i in range(int(input())):
	lenn = int(input())
	list1 = list(map(int, input().split()))
	x = list1.copy()
	x.sort()
	if 0 in list1 and 1 in list1:
		print('NO')
	elif x[-1] == x[0]:
		print('YES')
	elif 1 in list1:
		output = 'YES'
		for i in range(lenn - 1):
			if x[i] + 1 == x[i + 1]:
				output = 'NO'
				break
		print(output)
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a = list(set(a))
	a.sort()
	if len(a) > 1 and (a[0], a[1]) == (0, 1):
		print('NO')
		continue
	if a[0] > 1:
		print('YES')
		continue
	if a[0] == 0:
		print('YES')
	else:
		cdn = True
		for i in range(len(a) - 1):
			if a[i + 1] == a[i] + 1:
				cdn = False
				break
		if cdn:
			print('YES')
		else:
			print('NO')


def isEven(ls):
	for l in ls:
		if l % 2 == 1:
			return False
	return True

def isOdd(ls):
	for l in ls:
		if l % 2 == 0:
			return False
	return True
test = int(input())
for t in range(test):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 'YES'
	if a.count(a[0]) == n or isEven(a) == True or isOdd(a) == True:
		ans = 'YES'
	elif 1 in a:
		a.sort()
		for i in range(n - 1):
			if a[i + 1] - a[i] == 1:
				ans = 'NO'
				break
	else:
		ans = 'YES'
	print(ans)


def verify(arr, n):
	arr.sort()
	hasone = False
	for i in range(n):
		if arr[i] == 1:
			hasone = True
			break
		if arr[i] > 1:
			break
	if not hasone:
		return True
	for i in range(n - 1):
		if arr[i + 1] - arr[i] == 1:
			return False
	return True

def main():
	n = int(input())
	for i in range(n):
		m = int(input())
		arr = [int(j) for j in input().split()]
		if verify(arr, m):
			print('YES')
		else:
			print('NO')
main()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if 1 not in a:
		print('YES')
	elif 0 in a:
		print('NO')
	else:
		a.sort()
		for i in range(n - 1):
			if a[i + 1] == a[i] + 1:
				print('NO')
				break
		else:
			print('YES')


def solve():
	input()
	a = set([int(x) for x in input().split()])
	if len(a) == 1 or 1 not in a:
		return 'YES'
	a = sorted(a)
	for i in range(1, len(a)):
		if a[i] - a[i - 1] <= 1:
			return 'NO'
	return 'YES'
for tc in range(int(input())):
	print(solve())


t = int(input())
while t:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	one = 1 in l
	zero = 0 in l
	passed = True
	if not one:
		passed = True
	elif one and zero:
		passed = False
	else:
		l.sort()
		last = l[0]
		for element in l[1:]:
			if last != element and element - last == 1:
				passed = False
				break
			else:
				last = element
	if passed:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	if 1 not in a:
		print('YES')
	elif 0 in a:
		print('NO')
	else:
		a.sort()
		prev_value = -1
		for x in a:
			if prev_value + 1 == x:
				print('NO')
				break
			prev_value = x
		else:
			print('YES')


def test(a):
	a.sort()
	if a.count(1) == 0:
		return 'YES'
	elif a.count(0) > 0:
		return 'NO'
	else:
		for i in range(n - 1):
			if a[i + 1] - a[i] == 1:
				return 'NO'
		return 'YES'
T = int(input())
for _ in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	print(test(a))


import sys
input = sys.stdin.readline

def solve(n, arr):
	if n == 1:
		print('YES')
		return
	newList = set(arr)
	arr.sort()
	if 0 in newList and 1 in newList:
		print('NO')
		return
	if 1 not in newList:
		print('YES')
		return
	elif len(newList) == 1:
		print('YES')
	else:
		prev = arr[0]
		for i in range(1, n):
			if arr[i] == prev:
				continue
			if arr[i] - prev == 1:
				print('NO')
				return
			else:
				prev = arr[i]
		print('YES')
	return
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	solve(n, arr)


n = int(input())
for i in range(n):
	(_, L) = (input(), list(map(int, input().split())))
	if 1 in L:
		if 0 in L:
			print('NO')
		elif max(L) != 1:
			A = set(L)
			B = set(list(map(lambda x: x - 1, L)))
			if A & B == set():
				print('YES')
			else:
				print('NO')
		else:
			print('YES')
	else:
		print('YES')


t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().split()))
	if l.count(l[0]) == n:
		print('YES')
	elif 1 in l and 0 in l:
		print('NO')
	elif 1 in l:
		l.sort()
		pp = 'YES'
		for elem in range(len(l) - 1):
			if l[elem] + 1 == l[elem + 1]:
				pp = 'NO'
				break
		print(pp)
	else:
		print('YES')
	t -= 1


__author__ = 'tanunia'
t = int(input())
for _ in range(t):
	n = int(input())
	ar = sorted(list(map(int, input().split())))
	is_one = ar[0] == 1
	if is_one:
		failed = False
		for i in range(n):
			if ar[i] > 1:
				if ar[i] - 1 == ar[i - 1]:
					print('NO')
					failed = True
					break
		if not failed:
			print('YES')
	elif 1 in ar:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	(N, A) = (int(input()), list(map(int, input().split(' '))))
	A.sort()
	if 0 in A and 1 in A:
		print('NO')
	elif A[0] == 0 or A[0] >= 2:
		print('YES')
	elif 2 in A:
		print('NO')
	else:
		for i in range(N - 1):
			if A[i] != 1:
				if A[i + 1] - A[i] == 1:
					print('NO')
					break
		else:
			print('YES')


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print('YES')
		continue
	o = z = 0
	for i in a:
		if i == 1:
			o += 1
		elif i == 0:
			z += 1
	if o == 0:
		print('YES')
	elif a.count(a[0]) == n:
		print('YES')
	else:
		a.sort()
		ini = a[0]
		for i in range(1, n):
			if ini + 1 == a[i]:
				print('NO')
				break
			ini = a[i]
		else:
			print('YES')


tc = int(input())
for t in range(tc):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	one = 0
	zero = 0
	diff = 0
	previous = arr[0]
	for j in arr:
		if j == 0:
			zero = 1
		if j == 1:
			one = 1
		if abs(j - previous) == 1:
			diff = 1
			break
		previous = j
	if one and diff or (one and zero):
		print('NO')
	else:
		print('YES')


def solve():
	n = int(input())
	arr = [int(i) for i in input().split(' ')]
	arr.sort()
	if arr[0] == 1:
		for i in range(n - 1):
			if arr[i + 1] == arr[i] + 1:
				print('NO')
				return
	if arr[0] == 0:
		if 1 in arr:
			print('NO')
			return
	print('YES')
t = int(input())
for i in range(t):
	solve()


for _ in range(int(input())):
	n = int(input())
	a = sorted(set([*map(int, input().split())]))
	if 1 in a:
		for i in range(1, len(a)):
			if a[i] - a[i - 1] == 1:
				print('NO')
				break
		else:
			print('YES')
	else:
		print('YES')


for tcase in range(int(input())):
	(n,) = map(int, input().split())
	a = sorted(map(int, input().split()))
	i = 0
	while i < n and a[i] == 0:
		i += 1
	if i < n and a[i] == 1:
		j = 1
		while j < n and a[j] - a[j - 1] != 1:
			j += 1
		print('NO' if j < n else 'YES')
	else:
		print('YES')


from collections import defaultdict, deque
import sys
input = lambda : sys.stdin.readline().strip()
test_cases = int(input())
while test_cases > 0:
	test_cases -= 1
	n = int(input())
	a = list(map(int, input().split()))
	l = a[:]
	l.sort()
	if 0 in l and 1 in l:
		print('NO')
	elif 1 not in l:
		print('YES')
	elif l[0] == l[-1]:
		print('YES')
	elif 1 in l:
		count = 'YES'
		for i in range(len(a) - 1):
			if l[i] + 1 == l[i + 1]:
				count += 'NO'
				break
		if 'NO' in count:
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


for q in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	if 1 in arr:
		if 0 in arr:
			print('NO')
		else:
			arr.sort()
			flag = 0
			for i in range(1, n):
				if arr[i] - arr[i - 1] == 1:
					flag = 1
					break
			if flag:
				print('NO')
			else:
				print('YES')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l = sorted(l)
	ctr1 = 0
	for i in l:
		if i == 1:
			ctr1 += 1
			break
	temp = 0
	if ctr1 != 0:
		for i in range(n - 1):
			if abs(l[i + 1] - l[i]) == 1:
				temp += 1
				break
	if temp > 0:
		print('NO')
	elif ctr1 >= 0:
		print('YES')
	else:
		print('NO')


def main():
	n = int(input())
	arr = list(map(int, input().split()))
	if len(set(arr)) == 1:
		return 'YES'
	if 1 not in arr:
		return 'YES'
	arr.sort()
	for i in range(1, n):
		if arr[i] - arr[i - 1] == 1:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	print(main())


x = int(input())
for i in range(x):
	a = int(input())
	c = sorted([int(i) for i in input().split()])
	t = 0
	if 1 in c:
		for j in range(a - 1):
			if c[j + 1] - c[j] == 1:
				t = 1
				print('NO')
				break
		if t == 0:
			print('YES')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	hasOne = False
	flag = False
	for j in range(len(a)):
		if a[j] == 1:
			hasOne = True
	if hasOne == False:
		print('YES')
	else:
		a = sorted(a)
		for j in range(1, len(a)):
			if a[j] - a[j - 1] == 1:
				flag = True
				break
		if flag == True:
			print('NO')
		else:
			print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if min(a) > 1 or (1 in a) == False:
		print('YES')
	elif len(list(set(a))) == 1:
		print('YES')
	else:
		a.sort()
		for j in range(n - 1, 0, -1):
			if a[j] - a[j - 1] == 1:
				print('NO')
				a = []
				break
		if a != []:
			print('YES')


def solve(arr, n):
	arr.sort()
	check = False
	for ele in arr:
		if ele > 1:
			break
		if ele == 1:
			check = True
	if check:
		for i in range(n - 1):
			if arr[i] + 1 == arr[i + 1]:
				return False
	return True
t = int(input())
for i in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	ans = solve(arr, n)
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for tt in range(t):
	n = int(input())
	l = [int(i) for i in input().split(' ')]
	if 1 not in l:
		print('YES')
	else:
		flag = 1
		l.sort()
		for j in range(len(l) - 1):
			if l[j + 1] - l[j] == 1:
				flag = 0
				break
		if flag:
			print('YES')
		else:
			print('NO')


for i in range(int(input())):
	n = int(input())
	x = sorted(list(map(int, input().split())))
	if 1 in x:
		for i in range(len(x) - 1):
			if x[i + 1] - x[i] == 1:
				print('NO')
				break
		else:
			print('YES')
	else:
		print('YES')


for _ in range(int(input())):
	x = input()
	inp = [int(j) for j in input().split()]
	if 1 not in inp:
		print('YES')
	else:
		consec = False
		inp = sorted(inp)
		for i in range(len(inp) - 1):
			if inp[i] == inp[i + 1] - 1:
				consec = True
				break
		if consec:
			print('NO')
		else:
			print('YES')


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	if 1 not in a:
		print('YES')
	else:
		ok = True
		a.sort()
		for i in range(0, n - 1):
			if a[i] + 1 == a[i + 1]:
				ok = False
				break
		if ok:
			print('YES')
		else:
			print('NO')


def soluciona():
	_ = int(input())
	entrada = list(map(int, input().split()))
	if 1 not in entrada:
		print('YES')
	elif 0 in entrada or 2 in entrada:
		print('NO')
	else:
		entrada.sort()
		for h in range(1, len(entrada)):
			if entrada[h] == entrada[h - 1] + 1:
				print('NO')
				return
		print('YES')
	return
for _ in range(int(input())):
	soluciona()


T = int(input())
for _ in range(T):
	n = int(input())
	a = sorted(map(int, input().split()))
	if 1 in a:
		mark = True
		for i in range(1, n):
			if a[i] - a[i - 1] == 1:
				print('NO')
				mark = False
				break
		if mark:
			print('YES')
	else:
		print('YES')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	if 1 not in arr:
		print('YES')
	else:
		ans = 'YES'
		arr.sort()
		for i in range(n - 1):
			if arr[i] + 1 == arr[i + 1]:
				ans = 'NO'
				break
		print(ans)


t = int(input())
vet = []
for _ in range(0, t):
	n = int(input())
	sor = sorted(list(map(int, input().split())))
	if 1 in sor:
		for i in range(0, len(sor)):
			if i == len(sor) - 1:
				if sor[-1] - sor[i - 1] == 1:
					vet.append('NO')
					break
				else:
					vet.append('YES')
			elif sor[i + 1] - sor[i] == 1:
				vet.append('NO')
				break
	else:
		vet.append('YES')
print(*vet, sep='\n')


import math
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 'YES'
	(zero, one) = (False, False)
	for ele in a:
		if ele == 0:
			zero = True
		if ele == 1:
			one = True
	if not one:
		print('YES')
		continue
	if one and zero:
		print('NO')
		continue
	a.sort()
	for i in range(n - 1):
		if a[i + 1] - a[i] == 1:
			ans = 'NO'
			break
	print(ans)


import math, bisect, heapq, random, sys, itertools
input = sys.stdin.readline

def gprint(t, ans):
	print(f'Case #{t + 1}:', ans)
ints = lambda : list(map(int, input().split()))
alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
p2 = [1]
p = 10 ** 9 + 7
ANS = []
for t in range(int(input())):
	(n,) = ints()
	a = set(ints())
	if 0 in a and 1 in a:
		print('NO')
	elif 1 in a and 2 in a:
		print('NO')
	elif 1 in a:
		x = 0
		b = sorted(a)
		for i in range(len(b) - 1):
			if b[i] - b[i + 1] == -1:
				x = 1
				break
		if x:
			print('NO')
		else:
			print('YES')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	if len(set(lis)) == 1:
		print('YES')
		continue
	a = lis.count(1)
	b = lis.count(0)
	if a > 0 and b > 0:
		print('NO')
	elif a:
		lis.sort()
		ans = 'YES'
		for i in range(n - 1):
			if lis[i] == lis[i + 1] - 1:
				ans = 'NO'
				break
		print(ans)
	else:
		print('YES')


T = int(input())
for _ in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	A.sort()
	B = A.count(0)
	C = A.count(1)
	D = 0
	if B > 0 and C > 0:
		print('NO')
	elif C == 0:
		print('YES')
	else:
		for i in range(N - 1):
			if A[i] + 1 == A[i + 1]:
				D = 1
				break
		if D == 0:
			print('YES')
		else:
			print('NO')


n = int(input())
for _ in range(n):
	input()
	l = [int(i) for i in input().split()]
	res = 'YES'
	if len(l) > 1 and 1 in l:
		s = sorted(l)
		for i in range(len(s) - 1):
			if s[i + 1] - s[i] == 1:
				res = 'NO'
				break
	print(res)


def main():
	T = int(input())
	for k in range(T):
		n = int(input())
		array = list(map(int, input().split(' ')))
		freq = {}
		for i in range(n):
			if freq.get(array[i]) is None:
				freq[array[i]] = 1
			else:
				freq[array[i]] += 1
		count_one = 0
		for x in array:
			if x == 1:
				count_one += 1
		if count_one == n or count_one == 0:
			print('YES')
		else:
			flag = True
			for (k, v) in freq.items():
				if freq.get(k - 1) is not None:
					flag = False
					break
			if flag:
				print('YES')
			else:
				print('NO')
main()


test = int(input())
while test:
	test -= 1
	n = int(input())
	a = list(map(int, input().split()))
	flag1 = 0
	for i in range(n):
		if a[i] == 1:
			flag1 = 1
			break
	if flag1 == 0:
		print('YES')
	else:
		flag2 = 0
		a.sort()
		for i in range(n - 1):
			if a[i + 1] == a[i] + 1:
				flag2 = 1
				break
		if flag2 == 0:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = set(a)
	if len(s) == 1:
		print('YES')
	elif 1 in a:
		b = sorted(list(s))
		f = 1
		for i in range(1, len(b)):
			if b[i] - b[i - 1] == 1:
				f = 0
				break
		if f:
			print('YES')
		else:
			print('NO')
	else:
		print('YES')


import math
t = int(input())
res = []
for i in range(t):
	n = int(input())
	a = input().split()
	for i in range(len(a)):
		a[i] = int(a[i])
	b = set(a)
	if len(b) == 1:
		res.append('YES')
	elif 1 in b and 0 in b:
		res.append('NO')
	elif 1 in b:
		c = set()
		for i in b:
			c.add(i - 1)
		if c & b:
			res.append('NO')
		else:
			res.append('YES')
	else:
		res.append('YES')
for i in res:
	print(i)


t = int(input())

def checkConsecutive(l):
	for i in range(len(l)):
		if i < len(l) - 1 and l[i] + 1 == l[i + 1]:
			return True
for _ in range(t):
	input()
	arr = [int(x) for x in input().split()]
	arr.sort()
	if 1 not in arr:
		print('YES')
		continue
	if checkConsecutive(arr):
		print('NO')
		continue
	print('YES')


import math as m
i = input()
inp = []
for a in range(0, int(i)):
	input()
	inp += [input()]

def dec(arr):
	n = len(arr)
	if 1 in arr[0:2]:
		if arr[0] == 0 or 2 in arr[0:3]:
			return 'NO'
		for i in range(n - 1):
			if arr[i + 1] == arr[i] + 1:
				return 'NO'
	return 'YES'
for s in inp:
	arr = [int(x) for x in s.split()]
	arr = sorted(set(arr))
	print(dec(arr))


for i in range(int(input())):
	n = int(input())
	listt = [int(x) for x in input().split()]
	if 1 in listt:
		bol = True
		sett = set(listt)
		stlist = list(sett)
		stlist.sort(reverse=False)
		for j in range(1, len(stlist)):
			if stlist[j] - stlist[j - 1] == 1:
				bol = False
				break
		if bol:
			print('YES')
		else:
			print('NO')
	else:
		print('YES')


import math
from collections import *

def solve():
	n = int(input())
	a = [int(i) for i in input().split()]
	if len(set(a)) == 1:
		print('YES')
		return
	if 1 not in a:
		print('YES')
	elif 1 in a:
		a.sort()
		for i in range(n - 1):
			if a[i] + 1 == a[i + 1]:
				print('NO')
				return
		print('YES')
		return
	else:
		print('NO')
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	if 1 not in lst:
		print('YES')
	elif 0 in lst or 2 in lst:
		print('NO')
	else:
		s = set(lst)
		lst1 = list(s)
		err = 0
		lst1.sort()
		for h in range(1, len(lst1)):
			if lst1[h] == lst1[h - 1] + 1:
				err += 1
				break
		if err == 0:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	s = [int(i) for i in input().split()]
	b1 = False
	b2 = False
	if 0 in s:
		b1 = True
	if 1 in s:
		b2 = True
	if b1 and b2:
		print('NO')
	elif b1:
		print('YES')
	elif b2:
		s.sort()
		b3 = True
		for i in range(n - 1):
			if s[i] + 1 == s[i + 1]:
				b3 = False
				break
		if b3:
			print('YES')
		else:
			print('NO')
	else:
		print('YES')


def solution(n, nums):
	(odd, eve) = (0, 0)
	for k in nums:
		if k % 2 == 0:
			eve += 1
		else:
			odd += 1
	if eve == n or odd == n:
		return 'YES'
	(zero, one) = (False, False)
	for k in nums:
		if k == 0:
			zero = True
		if k == 1:
			one = True
	if zero and one:
		return 'NO'
	if one:
		nums.sort()
		for i in range(len(nums) - 1):
			if nums[i + 1] - nums[i] == 1:
				return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	nums = list(map(int, input().split()))
	print(solution(n, nums))


tc = int(input())
for _ in range(tc):
	x = int(input())
	y = list(map(int, input().split()))
	y.sort()
	if 1 in y:
		list1 = []
		for i in range(1, len(y)):
			list1.append(y[i] - y[i - 1])
		if 1 in list1:
			print('NO')
		else:
			print('YES')
	else:
		print('YES')