You are given the array $a$ consisting of $n$ positive (greater than zero) integers.

In one move, you can choose two indices $i$ and $j$ ($i \ne j$) such that the absolute difference between $a_i$ and $a_j$ is no more than one ($|a_i - a_j| \le 1$) and remove the smallest of these two elements. If two elements are equal, you can remove any of them (but exactly one).

Your task is to find if it is possible to obtain the array consisting of only one element using several (possibly, zero) such moves or not.

You have to answer $t$ independent test cases.


-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 1000$) — the number of test cases. Then $t$ test cases follow.

The first line of the test case contains one integer $n$ ($1 \le n \le 50$) — the length of $a$. The second line of the test case contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 100$), where $a_i$ is the $i$-th element of $a$.


-----Output-----

For each test case, print the answer: "YES" if it is possible to obtain the array consisting of only one element using several (possibly, zero) moves described in the problem statement, or "NO" otherwise.


-----Example-----
Input
5
3
1 2 2
4
5 5 5 5
3
1 2 4
4
1 3 4 4
1
100

Output
YES
YES
NO
NO
YES



-----Note-----

In the first test case of the example, we can perform the following sequence of moves:  choose $i=1$ and $j=3$ and remove $a_i$ (so $a$ becomes $[2; 2]$);  choose $i=1$ and $j=2$ and remove $a_j$ (so $a$ becomes $[2]$). 

In the second test case of the example, we can choose any possible $i$ and $j$ any move and it doesn't matter which element we remove.

In the third test case of the example, there is no way to get rid of $2$ and $4$.

Difficulty: EASY

Solutions:
import math
t = int(input())
for g in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	ans = 'YES'
	for i in range(1, n):
		if A[i] - A[i - 1] >= 2:
			ans = 'NO'
			break
	print(ans)


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


def res(l, n):
	if n == 1:
		return 1
	flag = 0
	for i in range(n - 1):
		if abs(l[i] - l[i + 1]) <= 1:
			flag = 1
		else:
			return 0
	if flag == 1:
		return 1
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ans = res(l, n)
	if ans == 1:
		print('YES')
	else:
		print('NO')


import sys
ii = lambda : sys.stdin.readline().strip()
idata = lambda : [int(x) for x in ii().split()]

def solve():
	n = int(ii())
	data = idata()
	data.sort()
	for i in range(1, n):
		if data[i] - data[i - 1] > 1:
			print('NO')
			return
	print('YES')
	return
for t in range(int(ii())):
	solve()


def check_array(arr):
	return all([b - a <= 1 for (a, b) in zip(list(sorted(arr))[:-1], list(sorted(arr))[1:])])

def main():
	t = int(input())
	for i in range(t):
		input()
		arr = list(map(int, input().split()))
		print('YES' if check_array(arr) else 'NO')
main()


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


t = int(input())
while t:
	t -= 1
	(n, con) = (int(input()), 1)
	a = sorted(list(map(int, input().split())))
	for i in range(n - 1):
		if a[i + 1] - a[i] >= 2:
			print('NO')
			con = 0
			break
	if con:
		print('YES')


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


def func(A):
	if len(A) == 1:
		return 'YES'
	A.sort()
	for i in range(1, len(A)):
		if A[i] == A[i - 1] or abs(A[i - 1] - A[i]) == 1:
			continue
		else:
			return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	print(func(A))


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(ele) for ele in input().split()]
	a.sort()
	i = 0
	while i < n - 1:
		if abs(a[i] - a[i + 1]) <= 1:
			if a[i] < a[i + 1]:
				a.remove(a[i])
			else:
				a.remove(a[i + 1])
			i -= 1
			n -= 1
		i += 1
	if len(a) == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = [int(j) for j in input().split()]
	c = 0
	l.sort(reverse=True)
	for i in range(0, n - 1):
		if l[i] - l[i + 1] > 1:
			c = 1
			break
	if c:
		print('NO')
	else:
		print('YES')


import os
import sys
from io import BytesIO, IOBase
import math

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
for i in range(int(input())):
	n = int(input())
	a = set(list(map(int, input().rstrip().split())))
	a = list(a)
	a.sort()
	flag = True
	for i in range(len(a) - 1):
		if a[i + 1] - a[i] != 1:
			flag = False
			break
	if flag == False:
		print('NO')
	else:
		print('YES')


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


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


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		ele = list(map(int, input().split()))
		if len(ele) == 1:
			print('YES')
		else:
			ele.sort()
			l = n
			for i in range(n - 1):
				if ele[i + 1] - ele[i] <= 1:
					l -= 1
			if l == 1:
				print('YES')
			else:
				print('NO')
main()


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	nums = list(map(int, stdin.readline().split()))
	nums.sort()
	ans = 'YES\n'
	for i in range(n - 1):
		if nums[i + 1] - nums[i] > 1:
			ans = 'NO\n'
			break
	stdout.write(ans)


t = int(input())
for i in range(t):
	n = int(input())
	arr = set(map(int, input().split()))
	if max(arr) - min(arr) < len(arr):
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	totalElement = int(input())
	if totalElement == 0:
		print('NO')
		break
	array = list(map(int, input().split()))
	array.sort()
	first = 0
	last = 1
	for j in range(totalElement):
		if len(array) == 1:
			print('YES')
			break
		if abs(array[first] - array[last]) <= 1:
			array.remove(array[first])
		else:
			print('NO')
			break


count = int(input())
for c in range(count):
	size = int(input())
	data = [int(i) for i in input().split()]
	sortt = sorted(data)
	ans = 'YES'
	for i in range(size - 1):
		if sortt[i + 1] - sortt[i] > 1:
			ans = 'NO'
			break
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	if n == 1:
		print('YES')
		continue
	g = []
	for i in range(n - 1):
		x = l[i + 1] - l[i]
		g.append(x)
	y = max(g)
	if y >= 2:
		print('NO')
	else:
		print('YES')


def inp(*, cf=lambda x: x):
	return cf(input())

def inpint():
	return inp(cf=int)

def inp_line(*, cf=lambda x: x, s=' '):
	return list(map(cf, input().split(s)))

def inpints():
	return inp_line(cf=int)

def intstostr(l):
	return ' '.join([str(x) for x in l])

def listtostr(l):
	return ' '.join(l)

def test_case(case):
	n = inpint()
	a = inpints()
	a.sort()
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) > 1:
			return 'NO'
	return 'YES'

def main():
	T = inpint()
	for t in range(1, T + 1):
		print(test_case(t))
main()


def small(a, b):
	length = len(a)
	n = a[0]
	for j in range(0, b):
		if abs(a[j] - n) > 1:
			return 'NO'
		n = a[j]
	return 'YES'
for i in range(int(input())):
	b = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	print(small(arr, b))


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


t = int(input())
for twst in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	s = set()
	for val in arr:
		s.add(val)
	if len(s) == 1:
		print('YES')
	else:
		l = []
		flag = 0
		for val in s:
			l.append(val)
		l = sorted(l)
		for i in range(1, len(l)):
			if l[i] - l[i - 1] <= 1:
				continue
			else:
				flag = 1
				break
		if flag == 0:
			print('YES')
		else:
			print('NO')


def lol(l, n):
	for i in range(1, n):
		if l[i] - l[i - 1] > 1:
			return 'NO'
	return 'YES'
for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	print(lol(l, n))


def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	arr = list(set(arr))
	ans = True
	if len(arr) == 1:
		ans = True
	arr.sort(reverse=True)
	for i in range(0, len(arr) - 1):
		if arr[i] - arr[i + 1] <= 1:
			continue
		else:
			ans = False
			break
	if ans == True:
		print('YES')
	else:
		print('NO')
	return
tc = int(input())
for i in range(tc):
	solve()


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


t = int(input())
while t > 0:
	n = int(input())
	l = list(map(int, input().split()))
	s = set(l)
	temp = list(s)
	temp.sort()
	flag = 0
	for i in range(1, len(temp)):
		if temp[i] - temp[i - 1] > 1:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')
	t = t - 1


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


import sys, math, collections
from collections import defaultdict

def file():
	sys.stdin = open('input.py', 'r')
	sys.stdout = open('output.py', 'w')

def get_array():
	l = list(map(int, input().split()))
	return l

def get_2_ints():
	(a, b) = map(int, input().split())
	return (a, b)

def get_3_ints():
	(a, b, c) = map(int, input().split())
	return (a, b, c)

def sod(n):
	(n, c) = (str(n), 0)
	for i in n:
		c += int(i)
	return c

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def getFloor(A, x):
	(left, right) = (0, len(A) - 1)
	floor = -1
	while left <= right:
		mid = (left + right) // 2
		if A[mid] == x:
			return A[mid]
		elif x < A[mid]:
			right = mid - 1
		else:
			floor = A[mid]
			left = mid + 1
	return floor

def floorSqrt(x):
	if x == 0 or x == 1:
		return x
	start = 1
	end = x
	while start <= end:
		mid = (start + end) // 2
		if mid * mid == x:
			return mid
		if mid * mid < x:
			start = mid + 1
			ans = mid
		else:
			end = mid - 1
	return ans

def main():
	for tt in range(int(input())):
		n = int(input())
		l = get_array()
		l.sort()
		if n == 1:
			print('YES')
			continue
		c = 0
		for i in range(1, n):
			if l[i] - l[i - 1] > 1:
				c = 1
				break
		if c:
			print('NO')
		else:
			print('YES')
main()


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	flag = False
	for i in range(n - 1):
		if abs(a[i + 1] - a[i]) > 1:
			flag = True
			break
	if flag:
		print('NO')
	else:
		print('YES')


import sys
import heapq
import math
from collections import deque
from collections import defaultdict
from collections import Counter
modH = int(10 ** 9) + 7
I = lambda : list(map(int, input().split(' ')))

def PRINT(lst, sep=' '):
	print(sep.join(map(str, lst)))
for _ in range(int(input())):
	n = int(input())
	lst = I()
	lst.sort()
	flag = 1
	if n == 1:
		print('YES')
	else:
		for i in range(n - 1):
			if lst[i + 1] - lst[i] <= 1:
				continue
			else:
				flag = 0
				break
		if flag:
			print('YES')
		else:
			print('NO')


t = int(input())
for testcase in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	f = True
	for i in range(1, len(arr)):
		if arr[i] > arr[i - 1] + 1:
			f = False
			break
	if f:
		print('YES')
	else:
		print('NO')


a = int(input())
for j in range(a):
	b = int(input())
	c = [int(x) for x in input().split()]
	flag = True
	c.sort()
	for i in range(1, len(c)):
		if c[i] - c[i - 1] == 1 or c[i - 1] == c[i]:
			pass
		else:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	lis = list(map(int, input().split()))
	lis.sort()
	temp = []
	for i in range(n):
		temp.append(lis[i])
	for i in range(1, n):
		if lis[i] - lis[i - 1] <= 1:
			temp.remove(lis[i - 1])
	if len(temp) == 1:
		print('YES')
	else:
		print('NO')


for gg in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr = sorted(arr)
	ans = 'YES'
	for i in range(n - 1):
		if abs(arr[i] - arr[i + 1]) > 1:
			ans = 'NO'
	print(ans)


t = int(input())
for i in range(t):
	guessFlag = 0
	n = int(input())
	if n == 1:
		print('YES')
		guessFlag = 1
	a = sorted(list(map(int, input().split())))
	if guessFlag == 0:
		greatestDiff = 0
		greatestDiff = [a[i + 1] - a[i] for i in range(len(a) - 1) if a[i + 1] - a[i] >= greatestDiff]
		greatestDiff = max(greatestDiff)
		if greatestDiff > 1:
			print('NO')
		else:
			print('YES')


for _ in range(int(input())):
	n = int(input())
	a = [*map(int, input().split())]
	a.sort()
	ans = 'YES'
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			ans = 'NO'
			break
	print(ans)


totLoop = int(input())
for x in range(totLoop):
	z = int(input())
	y = list(map(int, input().split()))
	y.sort()
	if len(y) > 1:
		flag = 1
		for i in range(len(y) - 1):
			if y[i + 1] - y[i] <= 1:
				pass
			else:
				flag = 0
				break
		if flag:
			print('YES')
		else:
			print('NO')
	else:
		print('YES')


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


def answer(n, A):
	if n == 1:
		return 'YES'
	A.sort()
	for i in range(1, n):
		if A[i] - A[i - 1] > 1:
			return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(answer(n, a))


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


n = int(input())
for i in range(n):
	t = int(input())
	L = list(map(int, input().split()))
	L.sort()
	flag = False
	for j in range(1, t):
		if L[j] - L[j - 1] > 1:
			print('NO')
			flag = True
			break
	if not flag:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	array = sorted(list(map(int, input().split())))
	count = 0
	flag = 0
	for i in range(len(array) - 1):
		if array[i + 1] - array[i] <= 1:
			count += 1
		if n - count == 1:
			flag = 1
			break
	if flag:
		print('YES')
	elif n == 1:
		print('YES')
	else:
		print('NO')


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


def fun(a, n):
	m = a[0]
	for i in range(1, n):
		if a[i] - m > 1:
			return 'NO'
		m = a[i]
	return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	print(fun(a, n))


t = int(input())
for g in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	m = list(set(l))
	m.sort()
	c = 0
	for i in range(len(m) - 1):
		x = abs(m[i] - m[i + 1])
		if x == 0 or x == 1:
			pass
		else:
			c = 1
			break
	if c == 1:
		print('NO')
	else:
		print('YES')


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


def sol(lis):
	lis.sort()
	if len(lis) == 1:
		return 'YES'
	stack = [lis[0]]
	for i in range(1, len(lis)):
		if abs(stack[-1] - lis[i]) <= 1:
			stack[-1] = lis[i]
		else:
			stack.append(lis[i])
	if len(stack) == 1:
		return 'YES'
	return 'NO'
k = int(input())
for i in range(k):
	input()
	lis = list(map(int, input().split(' ')))
	print(sol(lis))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	a.sort()
	chk = 0
	for x in range(n - 1):
		if abs(a[x] - a[x + 1]) > 1:
			chk = 1
	if chk == 1:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	st = []
	st.append(l[0])
	for i in range(1, len(l)):
		if abs(st[-1] - l[i]) <= 1:
			st.remove(st[-1])
			st.append(l[i])
		else:
			st.append(l[i])
	print('YES' if len(st) == 1 else 'NO')


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


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


import math
import collections
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect_left as bsl
from bisect import bisect_right as bsr
import heapq as hq
setrecursionlimit(2 ** 20)
t = 1
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().rstrip().split()))
	chk = True
	a.sort()
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			chk = False
			break
	if chk:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	input_string = input()
	input_data = input_string.split(' ')
	a = [int(x) for x in input_data]
	left_block = 0
	a.sort()
	k = 0
	newList = []
	flag = 0
	while k < n - 1:
		if a[k + 1] - a[k] > 1:
			print('NO')
			flag = 3
			break
		k = k + 1
	if flag == 0:
		print('YES')


def possible(s):
	s.sort()
	while True:
		bool = False
		n = len(s)
		for i in range(n - 1, 0, -1):
			if abs(s[i] - s[i - 1]) <= 1:
				del s[i]
				bool = True
		if not bool:
			if len(s) == 1:
				return 'YES'
			return 'NO'
for _ in range(int(input())):
	input()
	print(possible(list(map(int, input().split()))))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	book = 0
	if len(a) == 1:
		print('YES')
	else:
		for i in range(len(a) - 1):
			if a[i + 1] - a[i] > 1:
				book = 1
				print('NO')
				break
	if book == 0 and len(a) != 1:
		print('YES')


import math

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		numl = [int(n) for n in input().split()]
		if n == 1:
			print('YES')
		else:
			numl = sorted(numl)
			flag = 0
			for j in range(len(numl) - 1):
				if math.fabs(numl[j + 1] - numl[j]) > 1:
					print('NO')
					flag = 1
					break
			if flag == 0:
				print('YES')
main()


def solve(arr, n):
	for i in range(n - 1):
		if abs(arr[i] - arr[i + 1]) > 1:
			return False
	return True
T = int(input())
for t in range(T):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	if solve(arr, n):
		print('YES')
	else:
		print('NO')


(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, dgraphs, mod) = (lambda : sorted(zz()), {}, 10 ** 9 + 7)
from string import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
num = int(z())
for _ in range(num):
	n = int(z())
	l = szz()
	x = l[0]
	c = 0
	for i in l[1:]:
		if i - x > 1:
			c = 1
			break
		x = i
	if c == 0:
		print('YES')
	else:
		print('NO')


a = int(input())
for i in range(a):
	k = int(input())
	l = list(set(map(int, input().split())))
	l.sort()
	b = min(l)
	c = max(l) + 1
	if l == list(range(b, c)):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	count = 0
	n = int(input())
	arr = sorted(list(map(int, input().split())))
	if n > 1:
		for i in range(n - 1):
			if abs(arr[i + 1] - arr[i]) <= 1:
				count += 1
		if count == n - 1:
			print('YES')
		else:
			print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	num = int(input())
	rlist = list(map(int, input().split()))
	rlist.sort()
	it = 0
	for i in range(0, len(rlist)):
		for j in range(i + 1, len(rlist)):
			if abs(rlist[i] - rlist[j]) <= 1:
				it += 1
				break
	if it >= num - 1:
		print('YES')
	else:
		print('NO')


import math

def fun(a):
	count = 0
	for i in range(0, n - 1):
		if abs(a[i] - a[i + 1]) > 1:
			count += 1
		if count > 0:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	print(fun(a))


t = int(input())
for i in range(t):
	n = int(input())
	a = input().split()
	for i in range(n):
		a[i] = int(a[i])
	a = sorted(a)
	if n != 1:
		for i in range(n - 1):
			if a[i + 1] - a[i] >= 2:
				print('NO')
				break
			if i == len(a) - 2:
				print('YES')
				break
	else:
		print('YES')


a = int(input())
for i in range(a):
	b = int(input())
	l = list(map(int, input().split()))
	for i in range(b):
		l[i] = abs(l[i])
	l.sort()
	boo = True
	for i in range(1, b):
		if l[i] - l[i - 1] > 1:
			boo = False
			break
	if boo:
		print('YES')
	else:
		print('NO')


inp = lambda cast=int: [cast(x) for x in input().split()]
printf = lambda s='', *args, **kwargs: print(str(s).format(*args), flush=True, **kwargs)
(t,) = inp()
for _ in range(t):
	(n,) = inp()
	A = list(set(inp()))
	A = sorted(A)
	ok = True
	for i in range(len(A)):
		if A[i] != A[0] + i:
			ok = False
			break
	print('YES' if ok else 'NO')


for _ in range(int(input())):
	input()
	a = set(map(int, input().split()))
	print('YNEOS'[len(a) <= max(a) - min(a)::2])


import math
for test in range(int(input())):
	n = int(input())
	A = list(map(int, input('').split()))
	A.sort()
	flag = 0
	for i in range(1, n):
		if abs(A[i] - A[i - 1]) > 1:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l = sorted(l)
	b = True
	for i in range(n - 1):
		if l[i + 1] - l[i] <= 1:
			continue
		else:
			print('NO')
			b = False
			break
	if b:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	small_a = []
	for i in range(0, n - 1):
		if abs(a[i] - a[i + 1]) <= 1:
			small = min(a[i], a[i + 1])
			small_a.append(small)
	for i in range(len(small_a)):
		a.remove(small_a[i])
	if len(a) <= 1:
		print('YES')
	else:
		print('NO')


from sys import stdin
import sys
import functools
import heapq
from collections import *
sys.setrecursionlimit(100000)

def _input(type=int):
	return list(map(type, stdin.readline().split()))
for tc in range(_input()[0]):
	n = _input()[0]
	arr = deque(sorted(_input()))
	ans = True
	while len(arr) > 1:
		if arr[1] - arr[0] <= 1:
			arr.popleft()
		else:
			ans = False
			break
	print('YES' if ans else 'NO')


test = int(input())
for i in range(0, test):
	n = int(input())
	a = list(map(int, input().split()))
	leng = 0
	if n == 1:
		print('YES')
		continue
	else:
		a.sort()
		for i in range(0, n - 1):
			for j in range(i + 1, n):
				if i != j:
					if abs(a[i] - a[j]) <= 1:
						if a[i] < a[j]:
							del a[i]
							a.insert(i, -1)
						elif a[j] < a[i]:
							del a[j]
							a.insert(j, -1)
						elif a[i] == a[j]:
							del a[i]
							a.insert(i, -1)
		for j in a:
			if j > -1:
				leng += 1
		if leng == 1:
			print('YES')
		else:
			print('NO')


n = int(input())
for j in range(n):
	count = int(input())
	nums = [int(x) for x in input().split()]
	nums.sort()
	res = None
	if any([abs(nums[i] - nums[i + 1]) > 1 for i in range(len(nums) - 1)]):
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(sorted(map(int, input().split())))
	c = 1
	for j in range(n - 1):
		if abs(a[j] - a[j + 1]) >= 2:
			c = 0
			break
	if c == 0:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	x = [int(i) for i in input().split()]
	l = [0] * (max(x) + 1)
	p = min(x)
	q = max(x)
	for i in range(len(x)):
		l[x[i]] += 1
	for i in range(p, q + 1):
		if l[i] == 0:
			print('NO')
			break
	else:
		print('YES')


def check():
	f = 0
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			f = 1
			break
	return f
for _ in range(int(input())):
	n = int(input())
	a = sorted(map(int, input().split()))
	print('NO' if check() else 'YES')


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


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


t = int(input())
for _ in range(t):
	n = int(input())
	a = sorted(map(int, input().split()))
	x = a[0]
	for y in a[1:]:
		if y - x > 1:
			print('NO')
			break
		x = y
	else:
		print('YES')


tc = int(input())
for i in range(0, tc):
	n = int(input())
	lst = list(map(int, input().strip().split()))[:n]
	lst.sort()
	condition = False
	while True:
		if len(lst) == 1:
			condition = True
			break
		elif lst[1] - lst[0] <= 1 or lst[1] == lst[0]:
			lst.pop(0)
		else:
			break
	if condition == True:
		print('YES')
	else:
		print('NO')
	lst.clear()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	h = True
	for i in range(1, n):
		if l[i] - l[i - 1] > 1:
			h = False
	if h == False:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(0, n):
	m = int(input())
	l = list(map(int, input().split()))
	l.sort()
	i = 0
	if len(l) == 1:
		print('YES')
	else:
		while i < m - 1:
			if abs(l[i] - l[i + 1]) <= 1:
				if l[i] < l[i + 1]:
					l.pop(i)
					m = len(l)
					i = -1
					if len(l) == 1:
						print('YES')
						break
				elif l[i] > l[i + 1]:
					l.pop(i + 1)
					m = len(l)
					i = -1
					if len(l) == 1:
						print('YES')
						break
				else:
					l.pop(i)
					m = len(l)
					i = -1
					if len(l) == 1:
						print('YES')
						break
			i += 1
		if len(l) != 1:
			print('NO')


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


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for j in range(int(input())):
	n = int(input())
	vals = list(map(int, input().split()))
	vals.sort()
	a1 = 0
	a2 = 0
	for s in range(1, n):
		if abs(vals[s] - vals[s - 1]) <= 1:
			a1 += 1
	for s in range(n - 2, -1, -1):
		if abs(vals[s] - vals[s + 1]) <= 1:
			a2 += 1
	if a1 == n - 1 or a2 == n - 1:
		print('YES')
	else:
		print('NO')


test_cases = int(input())
for i in range(test_cases):
	input()
	nums = {int(n) for n in input().split()}
	if max(nums) - min(nums) + 1 == len(nums):
		print('YES')
	else:
		print('NO')


def removeSmallest(a: list) -> bool:
	if len(a) == 1:
		return True
	else:
		a.sort()
		i = 0
		while len(a) > 1:
			if a[i] == a[i + 1]:
				a.pop(i)
			elif abs(a[i + 1] - a[i]) == 1:
				a.pop(i)
			else:
				break
		if len(a) == 1:
			return True
		else:
			return False
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if removeSmallest(a):
		print('YES')
	else:
		print('NO')


t = int(input())
list_of_ans = []
for i in range(t):
	z = input()
	list1 = [int(i) for i in input().split()]
	list1_sort = sorted(list1)
	yes = 1
	for i in range(len(list1_sort) - 1):
		if list1_sort[i + 1] - list1_sort[i] <= 1:
			yes = 1
		else:
			yes = 0
			break
	if yes == 0:
		list_of_ans.append('NO')
	else:
		list_of_ans.append('YES')
for i in range(len(list_of_ans)):
	print(*list_of_ans[i], sep='')


def remove_min(a):
	a.sort()
	elem_cnt = len(a)
	curr_pos = 1
	prev_pos = 0
	while curr_pos < len(a) and elem_cnt > 1:
		if a[curr_pos] == a[prev_pos] or abs(a[curr_pos] - a[prev_pos]) <= 1:
			curr_pos += 1
			prev_pos += 1
			elem_cnt -= 1
		else:
			break
	return elem_cnt

def main():
	test_num = int(input())
	for _ in range(test_num):
		n = int(input())
		a = list(map(int, input().split()))
		print('YES' if remove_min(a) == 1 else 'NO')
main()


def func(t):
	for i in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		flag = True
		for i in range(len(a) - 1):
			if abs(a[i] - a[i + 1]) > 1:
				print('NO')
				flag = False
				break
		if flag:
			print('YES')
t = int(input())
func(t)


n = int(input())
for i in range(n):
	m = int(input())
	a = list(map(int, input().split()))
	a.sort()
	j = 1
	l = len(a)
	if l == 1:
		print('YES')
	else:
		while j < l - 1 and a[j] - a[j - 1] <= 1:
			j += 1
		if a[j] - a[j - 1] <= 1:
			print('YES')
		else:
			print('NO')


def solve(n, a):
	a.sort()
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			return 'NO'
	return 'YES'
t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	print(solve(n, a))
	t -= 1


t = input()
for i in range(int(t)):
	n = input()
	listA = []
	string = input()
	listB = string.split(' ')
	for item in listB:
		listA.append(int(item))
	listA.sort()
	import copy
	listB = copy.deepcopy(listA)
	for i in range(1, len(listA)):
		if abs(listA[i - 1] - listA[i]) <= 1:
			if listA[i - 1] <= listA[i]:
				listB.remove(listA[i - 1])
			else:
				listB.remove(listA[i])
	if len(listB) == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr = sorted(arr)
	flag = 0
	for i in range(n - 1):
		if arr[i] != arr[i + 1] and arr[i] + 1 != arr[i + 1]:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	result = 'YES'
	n = int(input())
	a = sorted(list(map(int, input().split())))
	k = 1
	while k < n:
		if a[k] - a[k - 1] >= 2:
			result = 'NO'
			break
		k += 1
	print(result)


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


x = int(input())
for _ in range(x):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	if n == 1:
		print('YES')
	else:
		flag = 0
		for i in range(1, n):
			if l[i] - l[i - 1] <= 1 and l[i] - l[i - 1] >= -1:
				continue
			else:
				flag = 1
				print('NO')
				break
		if flag == 0:
			print('YES')


for ii in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	f = False
	for jj in range(n - 1):
		if a[jj + 1] - a[jj] > 1:
			f = True
			break
	if f:
		print('NO')
	else:
		print('YES')


import sys, math, cmath, time
start_time = time.time()

def solve():
	n = inp()
	a = inlt()
	a = a + [max(a)]
	a.sort()
	if max([abs(a[i + 1] - a[i]) for i in range(len(a) - 1)]) <= 1:
		print('YES')
	else:
		print('NO')

def main():
	global tt
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	t = inp()
	for tt in range(t):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
		sys.stdout.close()

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q

def counter_elements(a):
	q = dict()
	for i in range(len(a)):
		if a[i] not in q:
			q[a[i]] = 0
		q[a[i]] = q[a[i]] + 1
	return q

def string_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = (q[ord(a[i]) - 97], 1)
	return q

def factors(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
			q.append(n // i)
	return list(sorted(list(set(q))))

def prime_factors(n):
	q = []
	while n % 2 == 0:
		q.append(2)
		n = n // 2
	for i in range(3, int(n ** 0.5) + 1, 2):
		while n % i == 0:
			q.append(i)
			n = n // i
	if n > 2:
		q.append(n)
	return list(sorted(q))

def transpose(a):
	(n, m) = (len(a), len(a[0]))
	b = [[0] * n for i in range(m)]
	for i in range(m):
		for j in range(n):
			b[i][j] = a[j][i]
	return b
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


def small(b, m):
	s = len(b)
	t = b[0]
	for i in range(0, m):
		if abs(b[i] - t) > 1:
			return 'NO'
		t = b[i]
	return 'YES'
for i in range(int(input())):
	m = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	print(small(arr, m))


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	data = input().split()
	for j in range(n):
		data[j] = int(data[j])
	d2 = []
	for j in data:
		if j not in d2:
			d2.append(j)
	d2.sort()
	while True:
		check = 1
		if len(d2) > 1:
			check = d2[1] - d2[0]
		if check == 1:
			d2.pop(0)
		else:
			ans.append('NO')
			break
		if len(d2) <= 1:
			ans.append('YES')
			break
for j in ans:
	print(j)


for i in range(int(input())):
	n = int(input())
	nums = list(map(int, input().split()))
	nums = sorted(nums)
	big = 0
	for k in range(n - 1):
		if abs(nums[k] - nums[k + 1]) > 1:
			print('NO')
			big = 1
			break
	if big == 0:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ok = True
	p = bool(ok)
	for i in range(1, n):
		p &= a[i] - a[i - 1] <= 1
	if p:
		print('YES')
	else:
		print('NO')


import math
from sys import stdin, stdout
import bisect
m = 10 ** 9 + 7

def inp():
	return int(stdin.readline())

def inpstr():
	return list(stdin.readline().strip())

def inpli():
	return list(map(int, input().split()))

def inpmap():
	return map(int, input().split())

def opt(n):
	stdout.write(str(n) + '\n')

def bexp(n, p):
	r = 1
	while p > 0:
		if p % 2:
			r = r * n
			p = p - 1
		else:
			n = n ** 2
			p = p // 2
	return r

def gcd(a, b):
	while b:
		a = a % b
		(b, a) = (a, b)
	return a

def sieve(limit):
	l = [1] * (limit + 1)
	l[0] = 0
	l[1] = 0
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segs(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def code():
	n = inp()
	l = inpli()
	l.sort()
	for i in range(1, n):
		if l[i] - l[i - 1] > 1:
			print('NO')
			break
	else:
		print('YES')
	return
for _ in range(inp()):
	code()


t = int(input())
for _ in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	new = list(set(lst))
	new.sort()
	flag = 0
	for i in range(len(new) - 1):
		if abs(new[i] - new[i + 1]) > 1:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


integer = int(input())
for i in range(integer):
	n = int(input())
	a = set(map(int, input().split()))
	if len(a) == max(a) - min(a) + 1:
		print('YES')
	else:
		print('NO')


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


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def main():
	t = int(input())
	for case in range(t):
		n = int(input())
		a = sorted(map(int, input().split()))
		for index in range(0, n - 1):
			if a[index + 1] - a[index] <= 1:
				n -= 1
		if n == 1:
			print('YES')
		else:
			print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	j = 0
	for i in range(len(a) - 1):
		if abs(a[i] - a[i + 1]) > 1:
			print('NO')
			j += 1
			break
	if j == 0:
		print('YES')


import math as mt
import sys, string
from collections import Counter, defaultdict
I = lambda : int(input())
M = lambda : map(int, input().split())
ARR = lambda : list(map(int, input().split()))

def printARR(arr):
	for e in arr:
		print(e, end=' ')
	print()

def main():
	n = I()
	a = ARR()
	a.sort()
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) > 1:
			print('NO')
			return
	print('YES')
tc = 1
tc = I()
for _ in range(tc):
	main()


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	mark = [1] * n
	a.sort()
	for i in range(n - 1):
		if a[i + 1] - a[i] <= 1:
			mark[i] = 0
	flag = sum(mark)
	if flag == 1:
		print('YES')
	else:
		print('NO')


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


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	flag = True
	i = 0
	while i < len(arr) - 1:
		if arr[i + 1] - arr[i] >= 2:
			flag = False
			break
		i += 1
	if flag:
		print('YES')
	else:
		print('NO')


from bisect import bisect_left
import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	l = int(input())
	m = list(map(int, input().split()))
	m.sort()
	if l == 1:
		print('YES')
	else:
		diff = 0
		for j in range(l - 1):
			diff = max(diff, abs(m[j] - m[j + 1]))
		if diff < 2:
			print('YES')
		else:
			print('NO')


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


import math
t = int(input())
for q in range(t):
	n = int(input())
	L = [int(i) for i in input().split()]
	L.sort()
	t = True
	for i in range(1, n):
		if L[i] - L[i - 1] > 1:
			t = False
			break
	if t:
		print('YES')
	else:
		print('NO')


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


from sys import stdin, stdout
from collections import Counter
I = lambda : map(int, stdin.readline().split())
I1 = lambda : stdin.readline()
for _ in range(int(I1())):
	n = int(I1())
	a = list(I())
	a.sort()
	f = 0
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			f = 1
			break
	print('YES' if f == 0 else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	george_boole = False
	length = len(arr)
	arr.sort()
	if length == 1:
		print('YES')
	else:
		for j in range(1, length):
			if abs(arr[j] - arr[j - 1]) > 1:
				george_boole = True
				break
		if george_boole:
			print('NO')
		else:
			print('YES')


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


for _ in range(int(input())):
	n = int(input())
	a = sorted([int(x) for x in set(input().split())])
	d = len(a)
	for i in range(d - 1):
		if a[i + 1] - a[i] == 1:
			a[i] = 0
	print('YES' if len([x for x in a if x]) == 1 else 'NO')


t = int(input())
for j in range(t):
	n = int(input())
	list1 = sorted(list(map(int, input().split(' '))))
	ct = 0
	if n == 1:
		print('YES')
	else:
		for j in range(0, n - 1):
			if abs(list1[j + 1] - list1[j]) > 1:
				ct += 1
				print('NO')
				break
		if ct == 0:
			print('YES')


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


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


n = int(input())
l = []
for i in range(n):
	arrSize = int(input())
	a = list(map(int, input().split()))
	if arrSize == 1:
		l.append('YES')
	else:
		a.sort()
		isPossible = True
		for k in range(arrSize - 1):
			if a[k + 1] - a[k] <= 1:
				continue
			else:
				isPossible = False
				break
		if isPossible:
			l.append('YES')
		else:
			l.append('NO')
for s in l:
	print(s)


from sys import stdin

def inp():
	return stdin.buffer.readline().rstrip().decode('utf8')

def itg():
	return int(stdin.buffer.readline())

def mpint():
	return map(int, stdin.buffer.readline().split())
for case in range(1, itg() + 1):
	n = itg()
	arr = sorted(mpint())
	a = arr[0]
	ans = 'YES'
	for i in range(1, n):
		if abs(arr[i] - a) > 1:
			ans = 'NO'
			break
		a = arr[i]
	print(ans)


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


for i in range(int(input())):
	x = int(input())
	f = 1
	l = [int(i) for i in input().split()]
	l.sort()
	for i in range(len(l) - 1):
		if l[i + 1] - l[i] > 1:
			f = 0
			break
	if f == 0:
		print('NO')
	else:
		print('YES')


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


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


for test_case in range(int(input())):
	length = int(input())
	arr = sorted(list(map(int, input().split())))
	cnt = 0
	if length == 1:
		print('YES')
	else:
		for x in range(1, length):
			if abs(arr[x] - arr[x - 1]) <= 1:
				cnt += 1
		if cnt == length - 1:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	lis = sorted(lis)
	last = lis[0]
	flag = 1
	for i in lis[1:]:
		if abs(i - last) <= 1:
			last = i
			continue
		else:
			flag = 0
	if flag == 1:
		print('YES')
	else:
		print('NO')


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


import sys
import math
mod = 10 ** 9 + 7
inf = float('inf')

def I():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))
t = I()
for _ in range(t):
	n = I()
	a = LI()
	a.sort()
	for i in range(n - 1):
		if a[i + 1] - a[i] >= 2:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
ret = []
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	s = 'YES'
	for i in range(len(l) - 1):
		if abs(l[i] - l[i + 1]) >= 2:
			s = 'NO'
			break
	ret.append(s)
sol = '\n'.join([str(x) for x in ret])
print(sol)


t = input()
for i in range(int(t)):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	test = True
	for x in range(int(n - 1)):
		if arr[x + 1] - arr[x] > 1:
			test = False
			break
	if test == True:
		print('YES')
	else:
		print('NO')


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


from sys import stdin, exit, setrecursionlimit
from collections import deque
input = stdin.readline
lmi = lambda : list(map(int, input().split()))
mi = lambda : map(int, input().split())
si = lambda : input().strip('\n')
ssi = lambda : input().strip('\n').split()
for _ in range(int(input())):
	n = int(input())
	arr = lmi()
	arr.sort()
	bad = False
	for i in range(1, n):
		if arr[i] - arr[i - 1] > 1:
			bad = True
	print('NO' if bad else 'YES')


t = int(input())
for _ in range(t):
	n = int(input())
	num = list(map(int, input().split()))
	num.sort()
	flag = 0
	for i in range(1, n):
		if num[i] - num[i - 1] > 1:
			flag = 1
			print('NO')
			break
	if flag == 1:
		continue
	print('YES')


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


for _ in range(int(input())):
	n = int(input())
	v = list(map(int, input().split()))
	v.sort()
	t = False
	for i in range(1, len(v)):
		if v[i] - v[i - 1] > 1:
			t = True
			break
	if t:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	X = [int(x) for x in input().split()]
	X = sorted(X)
	cnt = 0
	for j in range(len(X) - 1):
		if abs(X[j + 1] - X[j]) <= 1:
			cnt += 1
	if cnt == n - 1:
		print('YES')
	else:
		print('NO')


def small(a, n):
	l = len(a)
	t = a[0]
	for i in range(0, n):
		if abs(a[i] - t) > 1:
			return 'NO'
		t = a[i]
	return 'YES'
for i in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	print(small(ar, n))


from typing import List

def get_input():
	try:
		text = input()
		text = text.strip()
		if len(text) == 0:
			return None
		else:
			return text
	except EOFError:
		return None

def is_reducable(xs: List[int]):
	xs.sort()
	for (a, b) in zip(xs, xs[1:]):
		if b - a > 1:
			return False
	return True
total_cases = int(get_input())
for _ in range(total_cases):
	get_input()
	xs = list(map(int, get_input().split(' ')))
	if is_reducable(xs):
		print('YES')
	else:
		print('NO')


def solve(ar, n):
	for i in range(n - 1):
		if ar[i + 1] - ar[i] > 1:
			return 'NO'
	return 'YES'
for t in range(int(input())):
	n = int(input())
	ar = sorted(list(map(int, input().split())))
	print(solve(ar, n))


def solve():
	n = int(input())
	alst = list(map(int, input().split()))
	alst.sort()
	bef = alst[0]
	for a in alst:
		if a - bef >= 2:
			print('NO')
			return
		bef = a
	print('YES')
	return
t = int(input())
for _ in range(t):
	solve()


for _ in range(int(input())):
	n = int(input())
	arr = sorted(list(map(int, input().split())))
	last = arr[0]
	c = 0
	for el in arr:
		if el - last >= 2:
			c = 1
		last = el
	if c:
		print('NO')
	else:
		print('YES')


def solve():
	n = int(input())
	arr = sorted((int(v) for v in input().split()))
	for i in range(1, n):
		if arr[i] - arr[i - 1] > 1:
			print('NO')
			return
	print('YES')
t = int(input())
for _ in range(t):
	solve()


for i in range(int(input())):
	input()
	a = list(map(int, input().split()))
	a.sort()
	if len(a) == 1:
		print('YES')
	else:
		b = True
		for j in range(len(a) - 1):
			if abs(a[j] - a[j + 1]) >= 2:
				b = False
				break
		if b:
			print('YES')
		else:
			print('NO')


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


i = int(input())
for _ in range(i):
	yep = True
	input()
	numbs = sorted(list(map(int, input().split())))
	for f in range(1, len(numbs)):
		if numbs[f - 1] - numbs[f] < -1:
			yep = False
			break
	if yep:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	lst = list(map(int, input().strip().split()))[:n]
	lst.sort()
	check = 0
	for j in range(len(lst) - 1):
		if lst[j + 1] - lst[j] > 1:
			print('NO')
			check = 1
			break
	if check != 1:
		print('YES')


t = int(input())
for _ in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	a_sorted = a.sort()
	output = 'YES'
	for i in range(0, len(a) - 1):
		if a[i + 1] - a[i] > 1:
			output = 'NO'
	print(output)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	flag = 'YES'
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			flag = 'NO'
			break
	print(flag)


for _ in range(int(input())):
	i_liczb = int(input())
	liczby = sorted(set([int(x) for x in input().split()]))
	for x in range(len(liczby) - 1):
		if liczby[x + 1] - liczby[x] > 1:
			print('NO')
			break
	else:
		print('YES')


for i in range(int(input())):
	a = int(input())
	b = list(map(int, input().strip().split()))[:a]
	c = list(set(b))
	d = max(c)
	e = min(c)
	if d - e < len(c):
		print('YES')
	else:
		print('NO')


def fun():
	t = int(input())
	for _ in range(t):
		num = int(input())
		li = list(map(int, input().split()))
		flag = True
		if num == 1:
			print('YES')
			continue
		li.sort()
		flag = False
		for i in range(num - 1):
			if li[i] + 1 == li[i + 1] or li[i] == li[i + 1]:
				continue
			else:
				flag = True
		if flag:
			print('NO')
		else:
			print('YES')
fun()


a = int(input())
for i in range(a):
	b = int(input())
	c = list(map(int, input().split()))
	c.sort()
	h = 0
	for j in range(b - 1):
		if abs(c[j] - c[j + 1]) > 1:
			h = 1
			print('NO')
			break
	if h == 0:
		print('YES')


t = int(input())
while t > 0:
	n = int(input())
	l1 = list(map(int, input().strip().split()))
	l1.sort()
	flag = 0
	for i in range(0, n - 1):
		if l1[i + 1] - l1[i] > 1:
			flag = 1
			break
	if flag == 1:
		print('NO')
	elif flag == 0:
		print('YES')
	t -= 1


from collections import defaultdict as dfd
import math
import sys
import heapq

def II():
	return int(sys.stdin.readline())

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

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

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def main():
	for _ in range(int(input())):
		N = II()
		A = LI()
		A.sort()
		if N == 1:
			print('YES')
		else:
			val = 0
			for i in range(1, len(A)):
				if abs(A[i] - A[i - 1]) <= 1:
					val += 1
			if val == N - 1:
				print('YES')
			else:
				print('NO')
main()


import sys, math
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	ans = 'YES'
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) > 1:
			ans = 'NO'
			break
	print(ans)


t = int(input())
o = []
for each in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	c = 0
	if n > 1:
		for i in range(0, n - 1):
			if abs(a[i] - a[i + 1]) <= 1:
				c += 1
			else:
				break
		if c == n - 1:
			o.append('YES')
		else:
			o.append('NO')
	elif n == 1:
		o.append('YES')
for i in o:
	print(i)


n = int(input())
for i in range(n):
	x = int(input())
	l = list(map(int, input().split()))
	l.sort()
	a = 'YES'
	i = 0
	j = 1
	while j < len(l):
		if l[j] - l[i] > 1:
			a = 'NO'
			j = len(l) + 4
		else:
			i += 1
			j += 1
	print(a)


def solve(array):
	if len(array) == 1:
		return True
	array.sort()
	for index in range(0, len(array) - 1):
		(left, right) = (array[index], array[index + 1])
		if abs(left - right) > 1:
			return False
	return True
number_of_cases = int(input().strip())
for i in range(number_of_cases):
	try:
		array_len = int(input().strip())
		array = list(input().split())
		array = [int(n) for n in array if n != ' ' or n != '']
		if solve(array):
			print('YES')
		else:
			print('NO')
	except Exception as e:
		print(f'{e}')


tests = int(input())
for i in range(tests):
	length = int(input())
	l = list(map(int, input().split()))
	l.sort()
	j = 0
	if len(l) > 1:
		while len(l) != 2:
			if int(l[j + 1]) - int(l[j]) <= 1:
				l.remove(l[j])
			else:
				j += 1
			if j == len(l) - 1:
				break
		if len(l) == 2:
			if int(l[1]) - int(l[0]) <= 1:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
	else:
		print('YES')


import bisect
import decimal
from decimal import Decimal
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate
sys.setrecursionlimit(200000)
decimal.getcontext().prec = 46

def primeFactors(n):
	prime = set()
	while n % 2 == 0:
		prime.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			prime.add(i)
			n = n // i
	if n > 2:
		prime.add(n)
	return list(prime)

def getFactors(n):
	factors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				factors.append(i)
			else:
				factors.append(i)
				factors.append(n // i)
		i = i + 1
	return factors

def modefiedSieve():
	mx = 10 ** 7 + 1
	sieve = [-1] * mx
	for i in range(2, mx):
		if sieve[i] == -1:
			sieve[i] = i
			for j in range(i * i, mx, i):
				if sieve[j] == -1:
					sieve[j] = i
	return sieve

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	num = []
	for p in range(2, n + 1):
		if prime[p]:
			num.append(p)
	return num

def lcm(a, b):
	return a * b // math.gcd(a, b)

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]), reverse=True)

def list_input():
	return list(map(int, input().split()))

def num_input():
	return map(int, input().split())

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def DFS(n, s, adj):
	visited = [False for i in range(n + 1)]
	stack = []
	stack.append(s)
	while len(stack):
		s = stack[-1]
		stack.pop()
		if not visited[s]:
			visited[s] = True
		for node in adj[s]:
			if not visited[node]:
				stack.append(node)

def maxSubArraySum(a, size):
	maxint = 10 ** 10
	max_so_far = -maxint - 1
	max_ending_here = 0
	for i in range(0, size):
		max_ending_here = max_ending_here + a[i]
		if max_so_far < max_ending_here:
			max_so_far = max_ending_here
		if max_ending_here < 0:
			max_ending_here = 0
	return max_so_far

def solve():
	int(input())
	arr = sorted(list(set(list_input())))
	n = len(arr)
	for i in range(n - 1):
		if arr[i + 1] - arr[i] > 1:
			print('NO')
			return
	print('YES')
t = 1
t = int(input())
for _ in range(t):
	solve()


def ques1(n, a):
	a.sort()
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) > 1:
			print('NO')
			return
	print('YES')
t = int(input())
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	ans = ques1(n, a)
	ans


n = int(input())
for i in range(0, n):
	k = int(input())
	arr = list(map(int, input().split(' ')))
	arr.sort()
	b = False
	for j in range(1, k):
		if arr[j] - arr[j - 1] > 1:
			b = True
			break
	if b:
		print('NO')
	else:
		print('YES')


def solve():
	n = int(input())
	nums = list(map(lambda x: int(x), input().split()))
	nums.sort()
	num_bef = nums[0]
	for i in range(1, n):
		num = nums[i]
		if num_bef + 1 < num:
			return 'NO'
		num_bef = num
	return 'YES'
n = int(input())
for i in range(n):
	result = solve()
	print(result)


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


import sys
from collections import defaultdict
t = 1
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, sys.stdin.readline().strip().split()))
	a.sort()
	f = 0
	for j in range(1, n):
		if a[j] > a[j - 1] + 1:
			f = 1
			break
	if f:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	a = min(l)
	a1 = [i for i in range(a, a + len(set(l)))]
	l = list(set(l))
	l.sort()
	if len(l) == 1:
		print('YES')
	elif l == a1:
		print('YES')
	else:
		print('NO')


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


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


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


def smallest(a, n):
	l = len(a)
	s = a[0]
	for i in range(0, n):
		if abs(a[i] - s) > 1:
			return 'NO'
		s = a[i]
	return 'YES'
for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	print(smallest(arr, n))


import sys
lines = []
for line in sys.stdin:
	if 'exit' == line.rstrip():
		break
	lines.append(line)
t = int(lines[0])
for case in range(1, 2 * t + 1, 2):
	n = int(lines[case])
	a = [int(x) for x in lines[case + 1].split(' ')]
	a = sorted(a)
	possible = True
	for i in range(len(a) - 1):
		if a[i + 1] - a[i] > 1:
			possible = False
			print('NO')
			break
	if possible:
		print('YES')


import sys
input = sys.stdin.readline
t = int(input())
for t1 in range(t):
	n = int(input())
	l = list(map(int, input().split(' ')))
	l.sort()
	f = 0
	for i in range(1, n):
		if l[i] - l[i - 1] > 1:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


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


def calc(a):
	if not a:
		return False
	a = sorted(a)
	for i in range(len(a) - 1):
		if a[i] < a[i + 1] - 1:
			return False
	return True
T = int(input())
for t in range(T):
	N = int(input())
	a = [int(x) for x in input().split()]
	assert len(a) == N
	r = calc(a)
	print('YES' if r else 'NO')


for _ in range(int(input())):
	(__, a, res) = (input(), sorted([int(i) for i in input().split()]), 'YES')
	for (i, e) in enumerate(a[:-1]):
		if a[i + 1] > e + 1:
			res = 'NO'
	print(res)


import sys
input = sys.stdin.buffer.readline
t = int(input())
while t:
	t -= 1
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	istrue = False
	for i in range(n - 1):
		if arr[i + 1] - arr[i] > 1:
			istrue = True
			break
	if istrue:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	p = 1
	while len(a) > 1:
		if a[1] - a[0] > 1:
			p = 0
			break
		else:
			del a[0]
	if len(a) == 1 and p == 1:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = input()
	a = list(map(int, input().split()))
	a.sort()
	c = 0
	for i in range(len(a) - 1):
		if abs(a[i + 1] - a[i]) > 1:
			c += 1
			print('NO')
			break
	if c == 0:
		print('YES')


import math
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	if n == 1:
		print('YES')
		continue
	for i in range(1, n):
		if abs(l[i] - l[i - 1]) == 0 or abs(l[i] - l[i - 1]) == 1:
			continue
		else:
			print('NO')
			break
	else:
		print('YES')


def parse_array(array_str, n):
	array_str = array_str.split(sep=' ')
	arr = {}
	max_num = 0
	count = 0
	for i in range(0, n):
		num = int(array_str[i])
		if num > max_num:
			max_num = num
		if num in arr:
			continue
		arr[num] = num
		count = count + 1
	return (max_num, count, arr)

def one_element_possible(max_num, count, arr):
	ans = True
	for i in range(count, 0, -1):
		if max_num in arr:
			max_num = max_num - 1
			continue
		ans = False
		break
	return ans
test_cases = int(input(''))
for a in range(0, test_cases):
	n = int(input(''))
	array_str = input('')
	if n <= 0:
		print('NO')
		continue
	(max_num, count, arr) = parse_array(array_str, n)
	if count == 1:
		print('YES')
		continue
	ans = one_element_possible(max_num, count, arr)
	if ans == True:
		print('YES')
		continue
	print('NO')


t = int(input())
for i in range(0, t):
	n = int(input())
	inp = [int(item) for item in input().split(' ')]
	inp.sort()
	if n == 1:
		print('YES')
	else:
		ans = 'YES'
		for j in range(0, n - 1):
			if inp[j + 1] - inp[j] > 1:
				ans = 'NO'
				break
		print(ans)


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_right(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		n = I()
		l = list(In())
		l.sort()
		flag = 0
		for i in range(1, n):
			if l[i] - l[i - 1] >= 2:
				flag = 1
				break
		if flag == 1:
			no()
		else:
			yes()
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


from sys import stdin
n = int(stdin.readline())
for _ in range(n):
	stdin.readline()
	nums = list(map(int, stdin.readline().rstrip().split(' ')))
	nums.sort()
	ans = True
	for i in range(len(nums) - 1):
		if nums[i + 1] - nums[i] >= 2:
			ans = False
			break
	print('YES' if ans else 'NO')


def main():
	t = Iint()
	for _ in range(t):
		n = Iint()
		a = Ilist()
		a.sort()
		x = a[0]
		for i in range(1, n):
			if a[i] - x <= 1:
				x = a[i]
				continue
			else:
				print('NO')
				break
		else:
			print('YES')
FIO = 10

def I():
	return input()

def Iint():
	return int(input())

def Ilist():
	return list(map(int, input().split()))

def Imap():
	return map(int, input().split())

def Plist(li, s=' '):
	print(s.join(map(str, li)))
en = enumerate

def console(*args):
	print('\x1b[36m', *args, '\x1b[0m', file=sys.stderr)
	return
if not FIO:
	if __name__ == '__main__':
		main()
		exit()
else:
	from io import BytesIO, IOBase
	import sys
	import os
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for x in range(t):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	arr.sort()
	y = 0
	while y <= n - 2:
		if abs(int(arr[y + 1]) - int(arr[y])) <= 1:
			pass
		else:
			print('NO')
			break
		y = y + 1
	if y == n - 1:
		print('YES')


def sol():
	n = int(input())
	arr = list(map(int, input().split(' ')))
	arr = sorted(arr)
	for i in range(n - 1):
		if abs(arr[i + 1] - arr[i]) > 1:
			print('NO')
			return
	print('YES')
for _ in range(int(input())):
	sol()


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	count = 0
	i = 0
	for j in range(1, n):
		if abs(arr[j] - arr[i]) > 1:
			count += 1
		if count == 1:
			print('NO')
			break
		i += 1
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split(' ')))
	a_min = min(a)
	a_max = max(a)
	i = a_min
	flag = 1
	while i < a_max:
		if i + 1 not in a:
			flag = 0
			break
		else:
			i += 1
	if flag == 0:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	a = sorted(map(int, input().split()))
	r = 1
	for j in range(1, n):
		if a[j] - a[j - 1] > 1:
			r = 0
			break
	if r == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().strip().split(' ')))
	arr.sort()
	ans = 'YES'
	for i in range(1, n):
		if arr[i] - arr[i - 1] > 1:
			ans = 'NO'
			break
	print(ans)


a = int(input())
for i in range(a):
	b = int(input())
	c = [int(s) for s in input().split()]
	c.sort()
	ll = 'YES'
	for k in range(1, len(c)):
		if c[k] - c[k - 1] > 1:
			ll = 'NO'
			break
	print(ll)


import sys
input = lambda : sys.stdin.readline().rstrip()
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	cur = a[0]
	flag = 0
	for i in a[1:]:
		if i - cur > 1:
			flag = 1
		cur = i
	print(['YES', 'NO'][flag])


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	f = 1
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			f = 0
	if f:
		print('YES')
	else:
		print('NO')


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


no = int(input())
for i in range(no):
	l = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	for i in range(0, l - 1):
		if abs(arr[i] - arr[i + 1]) > 1:
			print('NO')
			break
	else:
		print('YES')


for testcases in range(int(input())):
	num = int(input())
	a = list(map(int, input().split()))
	flag = 0
	a.sort()
	if num == 1:
		flag = 0
	else:
		test = 0
		while test != num - 1:
			if a[test + 1] - a[test] > 1:
				flag = 1
				break
			else:
				test += 1
	if flag == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	i = 0
	while i < len(a):
		j = i + 1
		t = 0
		while j < len(a):
			if a[j] - a[i] == 1:
				a.remove(a[i])
				t = 67
				break
			elif a[j] - a[i] == -1:
				a.remove(a[j])
			elif a[j] == a[i]:
				a.remove(a[i])
			else:
				j = j + 1
		if t != 67:
			i = i + 1
	if len(a) == 1:
		print('YES')
	else:
		print('NO')


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


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


t = int(input())

def rs(arr):
	for i in range(1, len(arr)):
		if abs(arr[i] - arr[i - 1]) <= 1:
			continue
		else:
			return 0
	return 1
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	if len(arr) == 1:
		print('YES')
	elif rs(arr) == 1:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	N = int(input())
	l = list(set(list(map(int, input().split()))))
	l.sort()
	flag = True
	for i in range(len(l) - 1):
		if l[i] == l[i + 1] - 1:
			x = 0
		else:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(get_ints())
	a.sort()
	flag = True
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


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


def print_result(x, y):
	y.sort()
	ok = True
	for i in range(1, len(y)):
		ok = ok and abs(y[i] - y[i - 1]) <= 1
	if ok == True:
		print('YES')
	else:
		print('NO')
n = int(input())
for i in range(n):
	x = int(input())
	y = list(map(int, input().split()))
	print_result(x, y)
	n -= 1


from sys import stdin, stdout
int_in = lambda : int(stdin.readline())
arr_in = lambda : [int(x) for x in stdin.readline().split()]
mat_in = lambda rows: [arr_in() for _ in range(rows)]
str_in = lambda : stdin.readline().strip()
out = lambda o: stdout.write('{}\n'.format(o))
arr_out = lambda o: out(' '.join(map(str, o)))
bool_out = lambda o: out('YES' if o else 'NO')
tests = lambda : range(1, int_in() + 1)
case_out = lambda i, o: out('Case #{}: {}'.format(i, o))

def solve(n, a):
	a = sorted(a)
	if len(a) == 1:
		return True
	for i in range(1, len(a)):
		if a[i] - a[i - 1] > 1:
			return False
	return True
for _ in tests():
	n = int_in()
	a = arr_in()
	bool_out(solve(n, a))


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


T = int(input())
while T > 0:
	size = int(input())
	array = []
	array = list(map(int, input().split()))
	array.sort()
	counter = 0
	for i in range(size - 1):
		if array[i + 1] - array[i] > 1:
			counter += 1
	print('YES') if counter == 0 else print('NO')
	T = T - 1


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


t = int(input())
s = 0
while s < t:
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	res = 'YES'
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			res = 'NO'
	print(res)
	s = s + 1


for _ in range(int(input())):
	n = int(input())
	s = set(map(int, input().split()))
	print('YES' if max(s) - min(s) < len(s) else 'NO')


output = []
for _ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort()
	if n == 1:
		output.append('YES')
	else:
		m = n
		for _ in range(n - 1):
			if abs(arr[_] - arr[_ + 1]) == 1 or abs(arr[_] - arr[_ + 1]) == 0:
				m -= 1
			else:
				output.append('NO')
				break
		if m == 1:
			output.append('YES')
for _ in output:
	print(_)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ans = None
	l_new = set(l)
	if len(l_new) == 1:
		ans = 'YES'
	else:
		l_new = list(l_new)
		l_new.sort()
		while len(l_new) != 1:
			if l_new[1] - l_new[0] > 1:
				ans = 'NO'
				break
			else:
				ans = 'YES'
				del_ele = l_new[0]
				l_new.remove(del_ele)
	print(ans)


t = int(input())
for i in range(0, t):
	n = int(input())
	cin = input()
	vect = list(map(int, cin.split(' ')))
	vect.sort()
	isValid = True
	for h in range(0, n - 1):
		if vect[h + 1] - vect[h] > 1:
			print('NO')
			isValid = False
			break
	if isValid:
		print('YES')


n = int(input())
arr = []
for i in range(n):
	x = int(input())
	arr = list(map(int, input().split(' ')))
	arr.sort()
	ok = True
	for c in range(1, len(arr)):
		if arr[c] - arr[c - 1] > 1:
			ok = False
	if ok:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	boo = True
	arr.sort()
	for i in range(n - 1):
		if abs(arr[i] - arr[i + 1]) > 1:
			print('NO')
			boo = False
			break
	if boo:
		print('YES')


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


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	if n == 1:
		print('YES')
		continue
	fl = 0
	for i in range(n - 1):
		var = abs(ar[i] - ar[i + 1])
		if var > 1:
			fl = 1
			break
	if fl == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	a = [] * n
	d = [] * (n - 1)
	a = [int(i) for i in input().split()]
	if n == 1:
		print('YES')
		continue
	i = n - 1
	a.sort()
	while i > 0:
		if a[i - 1] != a[i] and a[i - 1] + 1 != a[i]:
			print('NO')
			break
		i -= 1
	if i == 0:
		print('YES')


for _ in range(int(input())):
	f = 0
	n = int(input())
	a = list(map(int, input().split()))
	x = list(set(a))
	if len(x) == 1:
		print('YES')
		continue
	else:
		y = [each for each in x]
		for i in range(len(x)):
			if f:
				break
			for j in range(len(x)):
				if len(y) == 1:
					f = 1
					print('YES')
					break
				if abs(x[j] - x[i]) == 1:
					try:
						y.remove(min(x[j], x[i]))
					except:
						pass
	if f == 0:
		print('NO')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	_ = int(input())
	a = [int(j) for j in input().split()]
	a.sort()
	res = True
	for j in range(1, len(a)):
		if a[j] > a[j - 1] + 1:
			res = False
			break
	print('YES' if res else 'NO')


t = int(input())

def rem_small(n, a, i):
	a.sort()
	if n == 1:
		return 'YES'
	elif abs(a[i - 1] - a[i]) <= 1:
		a.remove(min(a[i], a[i - 1]))
		i = 0
		return rem_small(n - 1, a, i)
	elif abs(a[i - 1] - a[i]) > 1:
		if i == n - 1:
			return 'NO'
		else:
			return rem_small(n, a, i + 1)
	else:
		return 'NO'
for i in range(t):
	n = int(input())
	a = [int(z) for z in input().split()]
	i = 1
	print(rem_small(n, a, i))


def solve():
	n = int(input())
	lst = list(map(int, input().split()))
	if len(set(lst)) == 1:
		print('YES')
		return
	ans = [i for i in range(min(lst), max(lst) + 1)]
	lst = list(set(lst))
	lst.sort()
	if lst == ans:
		print('YES')
	else:
		print('NO')
t = int(input())
for i in range(t):
	solve()


T = int(input())
for i in range(T):
	N = int(input())
	L = list(map(int, input().split()))
	L.sort()
	count = 0
	for j in range(N):
		for k in range(j + 1, N):
			K = L[j] - L[k]
			if K < 0:
				K = K * -1
			if K <= 1:
				count += 1
				break
	if N - count == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for test in range(t):
	n = int(input())
	arr = sorted(list([int(i) for i in input().split(' ')]))
	check_list = [arr[i + 1] - arr[i] <= 1 for i in range(n - 1)]
	if all(check_list):
		print('YES')
	else:
		print('NO')


import math
import os
import random
import re
import string
from sys import *
from collections import *

def bs(arr, x, l, r):
	if l <= r:
		mid = (r + l) // 2
		if arr[mid] == x:
			return mid
		elif arr[md] > x:
			return bs(arr, x, l, mid - 1)
		else:
			return bs(arr, x, mid + 1, r)
	else:
		return -1

def solve():
	for _ in range(int(stdin.readline())):
		n = int(stdin.readline())
		l = list(map(int, stdin.readline().strip().split()))
		if n == 1:
			print('YES')
		else:
			l.sort()
			f = 1
			for i in range(n - 1):
				if l[i + 1] - l[i] <= 1:
					continue
				else:
					f = 0
					break
			if f == 1:
				print('YES')
			else:
				print('NO')
solve()


for i in range(int(input())):
	n = int(input())
	arr = sorted(list(map(int, input().split(' '))))
	ans = 'YES'
	for j in range(len(arr) - 1):
		difference = abs(arr[j] - arr[j + 1])
		if difference > 1:
			ans = 'NO'
	print(ans)


import math
t = int(input())
for w in range(t):
	n = int(input())
	l = sorted([int(i) for i in input().split()])
	c = 1
	for i in range(1, n):
		if l[i] - l[i - 1] > 1:
			c = 0
			break
	if c == 1:
		print('YES')
	else:
		print('NO')


T = int(input())
for i in range(T):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	i = 0
	while i != len(l) - 1:
		if l[i + 1] - l[i] <= 1:
			l.remove(l[i])
		else:
			i = i + 1
	if len(l) == 1:
		print('YES')
	else:
		print('NO')


import bisect
import math
for xoxo in range(1):
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		a = list(set(a))
		a.sort()
		ans = 'YES'
		for i in range(1, len(a)):
			if a[i] != a[i - 1] + 1:
				ans = 'NO'
		print(ans)


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import *
for _ in range(ii()):
	n = ii()
	a = il()
	a.sort()
	c = 0
	for i in range(1, n):
		if abs(a[i] - a[i - 1]) > 1:
			c = c + 1
			print('NO')
			break
	if c == 0:
		print('YES')


import io, os
R = lambda : map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	a = list(R())
	a.sort()
	cnt = 0
	for i in range(1, n):
		if a[i] - a[i - 1] <= 1:
			cnt += 1
	print(['YES', 'NO'][cnt != n - 1])


no_cases = int(input())

def is_possible(test_case):
	if len(test_case) == 1:
		return True
	elif test_case[1] - test_case[0] == 1 or test_case[1] == test_case[0]:
		return is_possible(test_case[1:])
	else:
		return False
for _ in range(no_cases):
	no_digits = int(input())
	test_case = [int(x) for x in input().split()]
	test_case.sort()
	print('YES' if is_possible(test_case) else 'NO')


for _ in range(int(input())):
	n = int(input())
	a = []
	a[0:n] = map(int, input().split())
	l = list(set(a))
	zz = []
	count = 0
	a.sort()
	for i in range(len(a) - 1):
		j = i + 1
		if a[j] - a[i] > 1:
			count = 1
			break
	if count != 0:
		print('NO')
	else:
		print('YES')


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


def rem_smallest(arr):
	arr = sorted(arr)
	n = len(arr)
	i = 0
	while i <= n - 2:
		if n > 1:
			if abs(arr[i + 1] - arr[i]) <= 1:
				arr.pop(i)
				i -= 1
		n = len(arr)
		i += 1
	if len(arr) == 1:
		return 'YES'
	else:
		return 'NO'
nbtests = int(input())
results = []
for _ in range(nbtests):
	arrlen = int(input())
	arr = list(map(int, input().rstrip().split()))
	res = rem_smallest(arr)
	results.append(res)
for res in results:
	print(res)


for t in range(int(input())):
	n = int(input())
	flag = True
	a = list(map(int, input().strip().split()))
	b = set(a)
	(c, d) = (min(a), max(a))
	for i in range(c, d):
		if not i in b:
			flag = False
			print('NO')
			break
	if flag:
		print('YES')


import sys
input = sys.stdin.readline
inf = int(10000000000.0)
t = int(input())
while t:
	t -= 1
	n = int(input())
	lis = sorted(map(int, input().split()))
	g = 0
	for i in range(n - 1):
		if abs(lis[i] - lis[i + 1]) <= 1:
			continue
		else:
			g = 1
			break
	if g:
		print('NO')
	else:
		print('YES')


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


t = int(input())
for test in range(t):
	arr_len = int(input())
	arr = []
	arr = input().split(' ')
	arr = [int(a) for a in arr]
	arr.sort()
	flag = 0
	for ind in range(arr_len - 1):
		if int(arr[ind + 1]) - int(arr[ind]) > 1:
			pass
		else:
			flag += 1
	if flag == arr_len - 1:
		print('YES')
	else:
		print('NO')


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


test = int(input())
while test:
	n = int(input())
	nums = list(map(int, input().split()))
	if n == 1:
		print('YES')
	elif nums.count(nums[0]) == n:
		print('YES')
	else:
		nums = sorted(nums)
		while True:
			n = len(nums)
			if len(nums) == 1:
				print('YES')
				break
			m1 = max(nums)
			m2 = max(nums[:n - 1])
			if m1 - m2 == 0 or m1 - m2 == 1:
				nums.remove(m1)
			else:
				print('NO')
				break
	test -= 1


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


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


import math
import sys
import collections
import bisect
from collections import defaultdict
from sys import stdin, stdout
MOD = 10 ** 9 + 7
sys.setrecursionlimit(10 ** 7)

def take_root(num):
	return math.ceil(math.sqrt(num))

def sieve():
	limit = 86028121
	isprime = [1] * 86028122
	isprime[0] = 0
	isprime[1] = 0
	for i in range(2, take_root(limit + 1)):
		if isprime[i] == 1:
			for j in range(i * i, limit + 1, i):
				isprime[j] = 0
	primes = []
	for i in range(limit + 1):
		if isprime[i] == True:
			primes.append(i)
	return primes

def minput():
	return map(int, input().split())

def iinput():
	return int(input())

def strinput():
	return input()

def linput():
	return list(map(int, input().split()))
for _ in range(iinput()):
	n = iinput()
	arr = linput()
	arr = set(arr)
	arr = list(arr)
	arr.sort()
	flag = 0
	for i in range(1, len(arr)):
		if abs(arr[i] - arr[i - 1]) != 1:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


for ik in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	f = 0
	a.sort()
	for i in range(1, n):
		if abs(a[i] - a[i - 1]) <= 1:
			continue
		else:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


import sys
try:
	sys.stdin = open('inputs.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
finally:
	input = sys.stdin.readline
	print = sys.stdout.write
t = int(input())
for _ in range(t):
	out = 'YES'
	n = int(input())
	arr = sorted(map(int, input().split()))
	for i in range(1, len(arr)):
		if arr[i] - arr[i - 1] > 1:
			out = 'NO'
			break
	print(out)
	print('\n')


test = int(input())
for i in range(test):
	n = int(input())
	l = input().split()
	l = [int(i) for i in l]
	k = set(l)
	k = list(k)
	k.sort()
	if len(k) == 1:
		print('YES')
	else:
		for i in range(len(k) - 1):
			if abs(k[i] - k[i + 1]) != 1:
				print('NO')
				break
		else:
			print('YES')


t = int(input())

def fun(n, a):
	a.sort()
	flag = 0
	i = 0
	while i < n - 1:
		if a[i + 1] - a[i] > 1:
			flag += 1
			break
		i += 1
	if flag:
		print('NO')
	else:
		print('YES')
while t:
	t -= 1
	n = int(input())
	a = [int(i) for i in input().split()]
	fun(n, a)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	if len(l) == 1:
		print('YES')
		continue
	count = 0
	while True:
		j = 0
		a = l[j] - l[j + 1]
		if a < 0:
			a = a * -1
		else:
			a = a
		if a <= 1:
			del l[j]
		else:
			print('NO')
			count += 1
			break
		if len(l) == 1:
			print('YES')
			count += 1
			break
		j += 1
	if count == 0:
		print('NO')


for __ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	poo = False
	if n == 1:
		poo = False
	else:
		for i in range(1, n):
			if a[i] - a[i - 1] > 1:
				poo = True
	if poo:
		print('NO')
	else:
		print('YES')


T = int(input())

def solve(a):
	a.sort()
	last = a[0]
	for i in a[1:]:
		if i > last + 1:
			return False
		last = i
	return True
for t in range(T):
	N = input()
	a = list(map(int, input().split()))
	if solve(a):
		print('YES')
	else:
		print('NO')


def f(a, n):
	a.sort()
	for i in range(0, n - 1):
		if a[i + 1] - a[i] > 1:
			return False
	return True
t = int(input())
ans = []
for o in range(0, t):
	n = int(input())
	a = [int(it) for it in input().split(' ')]
	if f(a, n):
		ans.append('YES')
	else:
		ans.append('NO')
for it in ans:
	print(it)


t = int(input())
for i in range(t):
	n = int(input())
	lista = list(map(int, input().split()))
	lista.sort()
	flag = True
	for j in range(len(lista) - 1):
		if lista[j + 1] - lista[j] > 1:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


a = int(input())
for k in range(a):
	b = int(input())
	c = list(map(int, input().split()))
	c.sort()
	d = 'YES'
	for k in range(1, b):
		if c[k] - c[k - 1] > 1:
			d = 'NO'
			break
	print(d)


T = int(input())
for _ in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	flag = a[0]
	so = [a[0]]
	for i in range(n):
		if a[i] != flag:
			so.append(a[i])
			flag = a[i]
	cnt = 0
	n = len(so)
	for i in range(n - 1):
		if so[i + 1] != so[i] + 1:
			print('NO')
			cnt = 0
			break
		else:
			cnt = 1
	if cnt == 1:
		print('YES')
	if n == 1:
		print('YES')


n = int(input())
for t in range(n):
	q = int(input())
	a = sorted(list(map(int, input().split())))
	g = 0
	for i in range(0, q - 1):
		if abs(a[i] - a[i + 1]) > 1:
			g = 1
	if g != 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr_sort = sorted(arr)
	flag = True
	for k in range(1, n):
		if arr_sort[k] - arr_sort[k - 1] > 1:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


nb = int(input())
for k in range(nb):
	n = int(input())
	T = list(map(int, input().split(' ')))
	b = True
	while len(T) > 1 and b:
		x = max(T)
		T.remove(x)
		y = max(T)
		if x - y <= 1:
			pass
		else:
			b = False
	if b:
		print('YES')
	else:
		print('NO')


t = int(input())
while t != 0:
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	temp = 0
	for i in range(1, len(arr), 1):
		if arr[i] - arr[i - 1] > 1:
			temp = 1
			print('NO')
			break
	if temp == 0:
		print('YES')
	t = t - 1


t = int(input())
for i in range(t):
	n = int(input())
	a = input().split(' ')
	a = list(map(int, a))
	a.sort()
	b = a.copy()
	for i in range(len(a) - 1):
		if abs(a[i] - a[i + 1]) <= 1:
			b.remove(min(a[i], a[i + 1]))
		else:
			print('NO')
			break
	if len(b) == 1:
		print('YES')


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


from collections import Counter, defaultdict
BS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def to_base(s, b):
	res = ''
	while s:
		res += BS[s % b]
		s //= b
	return res[::-1] or '0'
alpha = 'abcdefghijklmnopqrstuvwxyz'
from math import floor, ceil, pi, log
import sys
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473, 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723, 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919]
import timeit

def primef(n, plst=[]):
	if n == 1:
		return plst
	else:
		for m in primes:
			if n % m == 0:
				return primef(n // m, plst + [m])
		return primef(1, plst + [n])

def lmii():
	return list(map(int, input().split()))

def ii():
	return int(input())

def countOverlapping(string, sub):
	count = start = 0
	while True:
		start = string.find(sub, start) + 1
		if start > 0:
			count += 1
		else:
			return count

def base10Len(n):
	return len(str(n))
t = int(input())
for i in range(t):
	n = int(input())
	nums = lmii()
	nums.sort()
	flag = False
	c = 0
	while c < len(nums) - 1:
		if nums[c + 1] - nums[c] > 1:
			print('NO')
			flag = True
			break
		c += 1
	if not flag:
		print('YES')


x = int(input())
for i in range(x):
	a = int(input())
	y = list(map(int, input().split()))
	z = len(y)
	y.sort()
	for i in range(len(y) - 1):
		if y[i + 1] - y[i] <= 1:
			z = z - 1
	if z == 1:
		print('YES')
	else:
		print('NO')


import math
from sys import stdin
from collections import Counter, defaultdict, deque
input = stdin.readline

def int1():
	return int(input())

def map1():
	return map(int, input().split())

def list1():
	return list(map(int, input().split()))
mod = pow(10, 9) + 7

def solve():
	n = int1()
	l1 = list1()
	l1.sort()
	c = 0
	for i in range(n - 1):
		if l1[i + 1] - l1[i] > 1:
			c = c + 1
	if c == 0:
		print('YES')
	else:
		print('NO')
for _ in range(int(input())):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	lst = sorted(list(map(int, input().split())))
	print(['YES', 'NO'][any((lst[i] - lst[i - 1] > 1 for i in range(1, n)))])


t = int(input())
while t:
	n = int(input())
	arr = list(map(int, input().split()))
	yes = 'YES'
	no = 'NO'
	if n == 1:
		print(yes)
	else:
		arr.sort()
		count = 0
		for i in range(n - 1):
			if arr[i + 1] - arr[i] <= 1:
				count += 1
		if count == n - 1:
			print(yes)
		else:
			print(no)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	np = False
	for i in range(n):
		if ar[i] - ar[i - 1] > 1:
			np = True
	if np:
		print('NO')
	else:
		print('YES')


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


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


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def print_list(l):
	print(' '.join(map(str, l)))
for _ in range(N()):
	n = N()
	nums = RL()
	s = list(set(nums))
	s.sort()
	last = s[0] - 1
	flag = True
	for a in s:
		if a != last + 1:
			flag = False
			break
		last = a
	if flag:
		print('YES')
	else:
		print('NO')


import sys
for i in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	b.sort()
	for i in range(len(b) - 1):
		if b[i + 1] - b[i] > 1:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	for i in range(1, len(a)):
		if abs(a[i] - a[i - 1]) >= 2:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	n = len(set(l))
	if n == 1:
		print('YES')
	elif n - 1 < max(l) - min(l):
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = input()
	a = list(map(int, input().split()))
	a.sort()
	i = 0
	while i < len(a) - 1:
		if a[i + 1] - a[i] == 1 or a[i] == a[i + 1]:
			a.remove(a[i])
			i -= 1
		i += 1
	if len(a) != 1:
		print('NO')
	else:
		print('YES')


n = int(input())
for _ in range(n):
	x = input()
	arr = list(map(int, input().split()))
	arr.sort()
	failed = False
	c = 0
	x = len(arr)
	while c < x - 1:
		if arr[c + 1] - arr[c] <= 1:
			c += 1
		else:
			failed = True
			break
	if failed:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	if len(arr) == 1:
		print('YES')
		continue
	arr = sorted(arr)
	res = 'YES'
	for i in range(len(arr) - 1):
		if abs(arr[i] - arr[i + 1]) > 1:
			res = 'NO'
	print(res)


def performOperations(arr):
	arr.sort()
	for i in range(n - 1):
		if arr[i + 1] - arr[i] > 1:
			print('NO')
			return
	print('YES')
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	performOperations(arr)


for _ in range(int(input())):
	input()
	arr = list(map(int, input().split()))
	removed = True
	while removed:
		mnm1 = 99999999
		mnm1_index = 0
		mnm2 = 99999999
		mnm2_index = 0
		removed = False
		for elem in range(len(arr)):
			if mnm1 > arr[elem]:
				mnm2 = mnm1
				mnm2_index = mnm1_index
				mnm1 = arr[elem]
				mnm1_index = elem
			elif mnm2 > arr[elem]:
				mnm2 = arr[elem]
				mnm2_index = elem
		if abs(mnm2 - mnm1) <= 1:
			removed = True
			arr.pop(mnm1_index)
	if len(arr) == 1:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	N = int(input())
	A = sorted(list(map(int, input().split())))
	dict_a = dict()
	for a in A:
		if a in dict_a.keys():
			dict_a[a] += 1
		else:
			dict_a[a] = 1
	keys = list(dict_a.keys())
	for i in range(len(keys) - 1):
		if keys[i] == keys[i + 1] - 1:
			dict_a[keys[i]] = 0
		else:
			dict_a[keys[i]] = 1
	if dict_a[keys[-1]]:
		dict_a[keys[-1]] = 1
	count = 0
	act_val = None
	for val in dict_a.values():
		if val > 0:
			act_val = val
			count += 1
	if count == 1:
		if act_val % 2 == 0 or act_val == 1:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from sys import stdin, stdout
input = lambda : stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	lst.sort()
	i = 0
	nd = 0
	while i < n - 1:
		if lst[i + 1] - lst[i] <= 1:
			i += 1
		else:
			nd = 1
			break
	if nd == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	size = int(input())
	a = map(int, input().split())
	if size == 1:
		print('YES')
		continue
	sortedd = sorted(a)
	check = True
	for i in range(1, size):
		if sortedd[i] - sortedd[i - 1] > 1:
			check = False
			break
	print('YES' if check else 'NO')


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


from collections import deque
from math import *
import heapq
from random import *
import sys
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	val = False
	for j in range(1, len(l)):
		if l[j] - l[j - 1] > 1:
			print('NO')
			val = True
			break
	if val != True:
		print('YES')


for i in range(int(input())):
	c = 1
	n = int(input())
	s = sorted([int(i) for i in input().split()])
	for i in range(n - 1):
		if s[i + 1] - s[i] > 1:
			c = 0
			break
	if c:
		print('YES')
	else:
		print('NO')


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


t = int(input())
for i in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	fl = True
	for i in range(n - 1):
		if fl and a[i + 1] - a[i] > 1:
			print('NO')
			fl = False
	if fl:
		print('YES')


for x in [0] * int(input()):
	a = int(input())
	l = sorted(list(map(int, input().split())))
	for i in range(a):
		try:
			if l[i] - l[i + 1] in [-1, 0]:
				pass
			else:
				print('NO')
				break
		except:
			print('YES')
			break


import sys
rl = lambda : next(sys.stdin)
t = int(rl())
for _ in range(t):
	n = int(rl())
	a = list(map(int, rl().split()))
	a.sort()
	ok = 1
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			ok = 0
			break
	if ok:
		print('YES')
	else:
		print('NO')


n = int(input())
an = []
for i in range(n):
	size = int(input())
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	for i in range(len(l) - 1):
		if l[i] - l[i + 1] == 0 or l[i] - l[i + 1] == 1:
			continue
		else:
			an.append('NO')
			break
	else:
		an.append('YES')
for i in an:
	print(i)


t = int(input())
for i in range(t):
	n = int(input())
	a = sorted(list(set(map(int, input().split()))))
	b = True
	for j in range(len(a)):
		if j > 0 and a[j - 1] - a[j] != -1:
			b = False
	if b:
		print('YES')
	else:
		print('NO')


for z in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a = sorted(a)
	for i in range(len(a) - 1):
		if abs(a[i] - a[i + 1]) <= 1:
			a[i] = True
		else:
			a[i] = False
	if False in a:
		print('NO')
	else:
		print('YES')


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


from sys import stdin
N = int(stdin.readline())
for i in range(N):
	flag = True
	length = int(stdin.readline())
	array = sorted([int(i) for i in stdin.readline().strip().split()])
	for i in range(1, length):
		diff = array[i] - array[i - 1]
		if diff > 1:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


T = int(input())
for t in range(T):
	n = int(input())
	A = sorted(set([int(i) for i in input().split()]))
	if len(A) == 1:
		print('YES')
	else:
		m = len(A)
		for i in range(1, m):
			if A[i] - A[i - 1] != 1:
				print('NO')
				break
		else:
			print('YES')


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


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


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


n = int(input())
ans = []
for i in range(n):
	lens = int(input())
	line = [int(x) for x in input().split(' ')]
	line.sort()
	for j in range(lens):
		if j < lens - 1 and line[j + 1] - line[j] > 1:
			ans.append('NO')
			break
		if j == lens - 1 and line[j] - line[j - 1] <= 1:
			ans.append('YES')
			break
for i in range(n):
	print(ans[i])


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


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


def popping_item(list_num, n):
	if n == 1:
		return list_num
	elif n == 2:
		if list_num[1] - list_num[0] <= 1:
			list_num.pop(0)
			return list_num
	elif list_num[n - 1] - list_num[n - 2] <= 1:
		list_num.pop()
		return popping_item(list_num, n - 1)
	return list_num
n_testcases = int(input())
for t in range(n_testcases):
	n_list = int(input())
	list_numbers = list(map(int, input().split()))
	list_numbers.sort()
	final_list = popping_item(list_numbers, n_list)
	if len(final_list) == 1:
		print('YES')
	else:
		print('NO')


import math
from decimal import Decimal
import heapq
import copy
import heapq
from collections import deque
from collections import defaultdict

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def da():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	return (n, m, a)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def lol(lst, k):
	k = k % len(lst)
	ret = [0] * len(lst)
	for i in range(len(lst)):
		if i + k < len(lst) and i + k >= 0:
			ret[i] = lst[i + k]
		if i + k >= len(lst):
			ret[i] = lst[i + k - len(lst)]
		if i + k < 0:
			ret[i] = lst[i + k + len(lst)]
	return ret

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)

def fact(n):
	tc = []
	ans = {}
	d = 2
	while d * d <= n:
		if n % d == 0:
			tc.append(d)
			n //= d
		else:
			d += 1
	if n > 1:
		tc.append(n)
	for i in tc:
		ans[i] = ans.get(i, 0) + 1
	return ans

def to_zero(n, s):
	lst = s[0]
	ans = []
	for i in range(n):
		if lst == s[i]:
			continue
		elif lst == '0':
			lst = '1'
			ans.append(i)
		else:
			lst = '0'
			ans.append(i)
	if lst == '1':
		ans.append(n)
	return ans
for g in range(int(input())):
	(n, a) = na()
	a = sorted(a)
	f = True
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			f = False
			break
	if f:
		print('YES')
	else:
		print('NO')


import sys
for _ in range(int(input())):
	n = int(input())
	my_list = list(map(int, sys.stdin.readline().split()))
	my_list.sort()
	flag = True
	if len(my_list) != 1:
		for i in range(len(my_list) - 1):
			if my_list[i] == my_list[i + 1] or my_list[i] + 1 == my_list[i + 1]:
				continue
			else:
				flag = False
				break
	if flag == True:
		print('YES')
	else:
		print('NO')


import math, sys
from collections import defaultdict, Counter, deque
INF = float('inf')
MOD = 1000000007

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def isPrime(n):
	if n <= 1:
		return False
	i = 2
	while i ** 2 <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def primeFactors(n):
	factors = []
	i = 2
	while i ** 2 <= n:
		while n % i == 0:
			factors.append(i)
			n //= i
		i += 1
	if n > 1:
		factors.append(n)
	return factors

def vars():
	return map(int, input().split())

def array():
	return list(map(int, input().split()))

def a():
	n = int(input())
	arr = array()
	arr.sort()
	res = 'YES'
	for i in range(1, n):
		if arr[i] != arr[i - 1] and arr[i - 1] + 1 != arr[i]:
			res = 'NO'
			break
	print(res)

def b():
	n = int(input())
	a = array()
	b = array()
	ma = min(a)
	mb = min(b)
	cnt = 0
	for i in range(n):
		if a[i] > ma:
			diff = min(b[i] - mb, a[i] - ma)
			cnt += diff
			a[i] -= diff
			b[i] -= diff
			cnt += a[i] - ma
	for i in range(n):
		cnt += b[i] - mb
	print(cnt)

def c():
	pass
t = int(input())
for _ in range(t):
	a()


for tc in range(int(input())):
	n = int(input())
	l1 = list(map(int, input().split()))
	l1.sort()
	flag = 2
	if len(l1) == 1:
		print('YES')
	else:
		for i in range(len(l1) - 1):
			if l1[i + 1] - l1[i] > 1:
				flag = 1
				break
			else:
				flag = 0
	if flag == 0:
		print('YES')
	elif flag == 1:
		print('NO')


n = int(input())

def checkConsecutive(l):
	return l == list(range(min(l), max(l) + 1))
for _ in range(n):
	throw = input()
	s = input()
	A = []
	s = s.split(' ')
	for x in s:
		A.append(int(x))
	A = set(A)
	A = list(A)
	A.sort()
	if checkConsecutive(A) == True:
		print('YES')
	else:
		print('NO')


def c(v, n):
	for i in range(n - 1):
		if abs(x[i] - x[i + 1]) > 1:
			print('NO')
			return
	print('YES')
	return
t = int(input())
for i in range(t):
	n = int(input())
	x = list(map(int, input().split(' ', n)))
	x.sort()
	c(x, n)


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(m,) = I()
while m:
	(n,) = I()
	arr = I()
	arr = sorted(arr)
	if n == 1:
		print('YES')
	else:
		flag = 0
		for i in range(1, n):
			if arr[i] - arr[i - 1] > 1:
				flag = 1
				break
		if flag == 1:
			print('NO')
		else:
			print('YES')
	m -= 1


t = int(input())
for i in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	b = 0
	for j in range(1, n):
		if a[j - 1] != a[j] - 1 and a[j - 1] != a[j]:
			b = 1
	print('YNEOS'[b::2])


def function(nums):
	nums1 = list(sorted(set(nums)))
	if len(nums1) == 1:
		return 'YES'
	else:
		total = 0
		for i in range(1, len(nums1)):
			if abs(nums1[i] - nums1[i - 1]) <= 1:
				total += 1
			else:
				return 'NO'
		return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	nums = list(map(int, input().rstrip().split()))
	print(function(nums))


t = int(input())
for i in range(t):
	num = int(input())
	s = set(map(int, input().split()))
	if max(s) - min(s) < len(s):
		print('YES')
	else:
		print('NO')


t = int(input())
for w in range(t):
	n = int(input())
	s = list(map(int, input().split()))
	s.sort()
	sol = 'YES'
	for i in range(n - 1):
		if s[i + 1] - s[i] > 1:
			sol = 'NO'
	print(sol)


from sys import stdin
from math import ceil, gcd

def func():
	return
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	arr = list(map(int, stdin.readline().split()))
	arr.sort()
	cond = True
	for i in range(n - 1):
		if arr[i + 1] - arr[i] > 1:
			cond = False
			break
	if cond == True:
		print('YES')
	else:
		print('NO')


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


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


def go(n, ai):
	ai.sort()
	for i in range(n - 1):
		if ai[i + 1] - ai[i] > 1:
			print('NO')
			return
	print('YES')
for i in range(int(input())):
	n = int(input())
	ai = list(map(int, input().split()))
	go(n, ai)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	c_arr = [0] * 101
	j = 0
	(m, mx) = (min(arr), max(arr))
	if n == 1:
		print('YES')
		continue
	for i in arr:
		c_arr[i] += 1
	for i in range(m, mx + 1):
		if c_arr[i - 1] > 0 and c_arr[i] == 0:
			print('NO')
			j = 1
			break
	if j == 0:
		print('YES')


t = int(input())
for i in range(t):
	x = int(input())
	list = [int(x) for x in input().split()]
	list.sort(reverse=False)
	ok = True
	for y in range(1, x):
		if list[y - 1] != list[y] and list[y - 1] + 1 != list[y]:
			ok = False
			break
	print('YES' if ok else 'NO')


n = int(input())
for i in range(0, n):
	m = int(input())
	l = list(map(int, input().split()))
	count = 0
	l.sort()
	s = sum(l)
	if len(l) == 1:
		print('YES')
		continue
	for i in range(1, m):
		if l[i] - l[i - 1] <= 1:
			s -= l[i - 1]
			l[i - 1] = 0
	if l[i] == s:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	ans = 'YES'
	for i in range(1, n):
		if abs(l[i] - l[i - 1]) > 1:
			ans = 'NO'
			break
	print(ans)


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	flag = 0
	while len(l) != 1:
		if abs(l[0] - l[1]) <= 1:
			l.remove(l[0])
		else:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


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


a = int(input())
for x in range(a):
	b = int(input())
	c = list(map(int, input().split()))
	c.sort()
	k = 0
	for y in range(b - 1):
		if c[y + 1] - c[y] > 1:
			k = 1
	if k == 1:
		print('NO')
	else:
		print('YES')


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


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = [int(i) for i in input().split()]
	(x0, x1) = (min(a), max(a))
	can_do = True
	for i in range(x0, x1):
		if not i in a:
			can_do = False
	if can_do:
		print('YES')
	else:
		print('NO')


def solve(a, n):
	cnt = 1
	for i in range(1, n):
		if abs(a[i] - a[i - 1]) > 1:
			return False
	return True
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	flag = solve(sorted(a), n)
	if flag:
		print('YES')
	else:
		print('NO')


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		if n == 1:
			print('YES')
			continue
		ok = 0
		for (i, v) in enumerate(a[:n - 1]):
			if a[i + 1] - v > 1:
				print('NO')
				ok = 1
				break
		if not ok:
			print('YES')
	return
main()


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	p = input()
	a = list(map(int, p.split()))
	a = sorted(list(set(a)))
	for j in range(len(a) - 1):
		diff = a[j + 1] - a[j]
		if abs(diff) > 1:
			ans.append('NO')
			break
	else:
		ans.append('YES')
for i in ans:
	print(i)


n = int(input())
ans = [0] * n
for i in range(n):
	k = int(input())
	s = [0] * k
	string = input().split(' ')
	for j in range(k):
		s[j] = int(string[j])
	s.sort()
	for j in range(k - 1):
		if s[j + 1] - s[j] > 1:
			ans[i] = 1
			break
for i in range(n):
	if ans[i]:
		print('NO')
	else:
		print('YES')


T = int(input())
for t in range(T):
	n = int(input())
	nums = [int(x) for x in input().split(' ')]
	nums.sort()
	good = True
	for i in range(len(nums) - 1):
		if nums[i] - nums[i + 1] not in {-1, 0, 1}:
			good = False
			break
	print('YES' if good else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	d = []
	if len(a) == 1:
		print('YES')
	else:
		for i in range(n - 1):
			if abs(a[i] - a[i + 1]) <= 1:
				d.append(abs(a[i] - a[i + 1]))
			else:
				pass
		if len(d) + 1 == len(a):
			print('YES')
		else:
			print('NO')


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


def cin():
	return list(map(int, input().split()))
t = int(input())
while t:
	n = int(input())
	a = cin()
	a.sort()
	ans = 'YES'
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			ans = 'NO'
			break
	print(ans)
	t -= 1


n = int(input())
for i in range(0, n):
	o = int(input())
	p = input().rstrip().split(' ')
	p.sort(key=int)
	C = list(p)
	G = 0
	C.sort(key=int)
	if n == 1:
		print('YES')
	else:
		for j in range(0, len(C) - 1):
			if int(C[j + 1]) - int(C[j]) <= 1:
				continue
			else:
				G = 1
				break
		if G == 0:
			print('YES')
		else:
			print('NO')


from sys import stdin
for _ in range(int(stdin.readline().rstrip())):
	n = int(stdin.readline().rstrip())
	l = list(map(int, stdin.readline().rstrip().split(' ')))
	l.sort()
	r = 'YES'
	for i in range(1, n):
		if l[i] - l[i - 1] > 1:
			r = 'NO'
			break
	print(r)


for i in range(int(input())):
	j = int(input())
	data = sorted([int(k) for k in input().split()])
	res = 0
	for i in range(j - 1):
		if abs(data[i] - data[i + 1]) <= 1:
			res += 1
	if res == j - 1:
		print('YES')
	else:
		print('NO')


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


import sys, math
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	a = list(map(int, sys.stdin.readline().split()))
	a.sort()
	total = 0
	if n != 1:
		for i in range(n - 1):
			if abs(a[i] - a[i + 1]) > 1:
				total += 1
		if total > 0:
			print('NO')
		else:
			print('YES')
	else:
		print('YES')


t = int(input())
while t:
	a = []
	n = int(input())
	k = input().split()
	for i in k:
		a.append(int(i))
	a.sort()
	flag = 1
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')
	t = t - 1


t = int(input())
for test in range(t):
	n = int(input())
	ls = list(map(int, input().split()))
	ls.sort()
	prev = -1
	for i in ls:
		if prev != -1 and i - prev > 1:
			print('NO')
			break
		else:
			prev = i
	else:
		print('YES')


t = int(input())
for _ in range(0, t):
	n = int(input())
	arr = list(map(int, input().strip().split(' ')))
	arr.sort()
	if len(arr) == 1:
		print('YES')
		continue
	c = 0
	for i in range(1, len(arr)):
		if abs(arr[i - 1] - arr[i]) <= 1:
			continue
		else:
			c = 1
			break
	if c == 0:
		print('YES')
	else:
		print('NO')


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


for _ in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()]
	if n == 1:
		print('YES')
	else:
		l = sorted(l)
		for i in range(1, n):
			if l[i] - l[i - 1] > 1:
				print('NO')
				break
		else:
			print('YES')


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


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


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	nList = list(map(int, input().split()))
	if len(nList) == 1:
		print('YES')
	else:
		nList.sort()
		flag = True
		for i in range(n - 1):
			if nList[i + 1] - nList[i] >= 2:
				flag = False
				break
		if flag:
			print('YES')
		else:
			print('NO')


def so(ar, n):
	for i in range(n):
		for j in range(i + 1, n):
			if ar[i] > ar[j]:
				temp = ar[i]
				ar[i] = ar[j]
				ar[j] = temp

def rem(ar, n):
	f = 0
	for i in range(0, n - 1):
		if ar[i] - ar[i + 1] > 1 or ar[i] - ar[i + 1] < -1:
			print('NO')
			f = 1
			break
	if f == 0:
		print('YES')
t = int(input())
for i in range(t):
	n = int(input())
	ar = [int(x) for x in input().split()]
	so(ar, n)
	rem(ar, n)


t = int(input())
for i in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	i = 0
	j = 0
	while i < n - 1:
		j = i + 1
		while j < n:
			if arr[j] - arr[i] <= 1:
				arr.pop(i)
				n -= 1
				i = 0
				j = 0
			j += 1
		i += 1
	if len(arr) == 1:
		print('YES')
	else:
		print('NO')


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


from sys import stdin, stdout

def input():
	return stdin.readline().strip()

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


t = int(input())
for _ in range(t):
	n = int(input())
	x = [int(x) for x in input().split()]
	x.sort()
	flag = 0
	if n == 1:
		print('YES')
	else:
		for i in range(n - 1):
			if abs(x[i] - x[i + 1]) <= 1:
				continue
			else:
				flag = 1
				break
		if flag == 1:
			print('NO')
		else:
			print('YES')


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


for _ in range(int(input())):
	(n,) = map(int, input().split())
	w = sorted(map(int, input().split()))
	r = all((y - x < 2 for (x, y) in zip(w, w[1:])))
	print('YES' if r else 'NO')


from math import *
from collections import *
from random import *
from decimal import Decimal
from bisect import *
import sys
input = sys.stdin.readline

def lis():
	return list(map(int, input().split()))

def ma():
	return map(int, input().split())

def inp():
	return int(input())

def st():
	return input().rstrip('\n')
t = inp()
while t:
	t -= 1
	n = inp()
	a = lis()
	fl = 0
	a.sort()
	if n == 1:
		print('YES')
		continue
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) > 1:
			fl = 1
			break
	if fl:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	s = sorted(list(map(int, input().split())))
	print('YES' if all((s[ele] - s[ele - 1] <= 1 for ele in range(1, n))) else 'NO')


f = 1
te = int(input())
for i in range(te):
	n = int(input())
	a = list(map(int, input().rstrip().split()))
	a.sort()
	if len(a) == 1:
		f = 1
	else:
		j = 0
		while j < len(a) - 1:
			if a[j + 1] - a[j] > 1:
				f = 0
				break
			else:
				f = 1
			j += 1
	if f == 0:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = True
	now = 1
	while ans and now < n:
		if abs(a[now] - a[now - 1]) > 1:
			ans = False
		now += 1
	if ans:
		print('YES')
	else:
		print('NO')


import sys

def main():
	res = ''
	input = sys.stdin.readline
	print = sys.stdout.write
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = list(set(map(int, input().split())))
		a.sort()
		sub_res = 'YES\n'
		for i in range(len(a) - 1):
			if abs(a[i] - a[i + 1]) > 1:
				sub_res = 'NO\n'
				break
		res += sub_res
	print(res)
main()


a = int(input())
i = 0
b = []
ab = []
while i < a:
	b = int(input())
	aa = list(map(int, input().strip().split()))
	aa.sort()
	if len(aa) == 1:
		ab.append('YES')
	else:
		l = 0
		m = 1
		while l < len(aa) - 1:
			cp = 0
			if abs(aa[l] - aa[m]) < 1:
				cp = 1
			elif abs(aa[l] - aa[m]) == 1:
				cp = 1
			else:
				cp = 0
				break
			m += 1
			l += 1
		if cp == 1:
			ab.append('YES')
		else:
			ab.append('NO')
	i += 1
for each in ab:
	print(each)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	a1 = a.copy()
	for i in range(n):
		if i < n - 1:
			if abs(a[i] - a[i + 1]) <= 1:
				if a[i + 1] > a[i]:
					a1.remove(a[i])
				else:
					a1.remove(a[i + 1])
	if len(a1) > 1:
		print('NO')
	elif len(a1) == 1:
		print('YES')


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		n = int(input())
		arry = list(map(int, input().split()))
		if n == 1:
			yield 'YES'
		else:
			ans = True
			arry.sort()
			for i in range(n - 1):
				if arry[i + 1] - arry[i] > 1:
					ans = False
					break
			yield ('YES' if ans else 'NO')
t = int(input())
ans = gift()
print(*ans, sep='\n')


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


import math

def solve(a):
	a.sort()
	for i in range(len(a) - 1):
		if abs(a[i] - a[i + 1]) > 1:
			return 'NO'
	return 'YES'
t = int(input())
sol = []
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	sol.append(solve(a))
for i in sol:
	print(i)


t = int(input())
for i in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	f = 0
	for j in range(0, n - 1):
		if a[j + 1] - a[j] > 1:
			print('NO')
			f = 1
			break
	if f == 0:
		print('YES')


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


def q661a():
	num_cases = int(input())
	for _ in range(num_cases):
		arr_size = int(input())
		arr = []
		if arr_size == 1:
			arr = [int(input())]
		else:
			arr = [int(num) for num in input().split()]
		arr.sort()
		is_slowly_increasing = q661a_is_slowly_increasing(arr, arr_size)
		if is_slowly_increasing == True:
			print('YES')
		else:
			print('NO')

def q661a_is_slowly_increasing(arr, arr_size):
	if arr_size == 1:
		return True
	for i in range(0, arr_size - 1):
		if arr[i + 1] - arr[i] > 1:
			return False
	return True
q661a()


import sys
input = sys.stdin.readline
t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	fl = True
	for i in range(n - 1):
		if l[i + 1] - l[i] <= 1:
			continue
		else:
			fl = False
			break
	if fl:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(s) for s in input().split(' ')]
	a.sort()
	ok = True
	if n == 1:
		print('YES')
	else:
		for i in range(n - 1):
			if abs(a[i] - a[i + 1]) > 1:
				print('NO')
				ok = False
				break
		if ok:
			print('YES')


for i in range(int(input())):
	n = int(input())
	arr = list(set(map(int, input().split())))
	arr.sort()
	if len(arr) == 1:
		print('YES')
	else:
		ans = 0
		for i in range(0, len(arr) - 1):
			diff = abs(arr[i + 1] - arr[i])
			if diff >= 2:
				ans += 1
		if ans >= 1:
			print('NO')
		else:
			print('YES')


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


from sys import stdin
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	n = int(inp())
	a = [int(x) for x in inp().split()]
	a.sort()
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) > 1:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	arr = s.split()
	c = 0
	for i in range(n):
		arr[i] = int(arr[i])
	arr.sort()
	for j in range(n - 1):
		if arr[j + 1] - arr[j] > 1:
			c = 1
			break
	if c == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	l = list(input().split(' '))
	l.sort(key=lambda x: int(x))
	if n == 1:
		print('YES')
	else:
		for m in range(n - 1):
			a = 0
			if abs(int(l[m]) - int(l[m + 1])) > 1:
				print('NO')
				a = 1
				break
		if a == 0:
			print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = input().split()
	for i in range(n):
		arr[i] = int(arr[i])
	arr = sorted(arr)
	a = True
	for i in range(n - 1):
		if abs(arr[i] - arr[i + 1]) > 1:
			a = False
			break
	if not a:
		print('NO')
	else:
		print('YES')


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


n = int(input())
for i in range(0, n):
	m = int(input())
	t = input()
	t = t.split(' ')
	t = list(map(int, t))
	t = sorted(t)
	(count, k, flag) = (0, 0, 0)
	i = 1
	l = len(t)
	while l != 1:
		if t[i] - t[i - 1] == 1:
			count = count + 1
			if flag == 0:
				k = i - 1
				flag = 1
			i = i + 1
		elif t[i] - t[i - 1] == 0:
			t.remove(t[i])
		else:
			if count != 0:
				t = t[:k] + t[k + count:]
				i = i - count
				count = 0
			else:
				i = i + 1
			flag = 0
		l = l - 1
	if count != 0:
		t = t[:k] + t[k + count:]
	if len(t) == 1:
		print('YES')
	else:
		print('NO')


import collections
from functools import lru_cache

def read():
	return input().strip()

def readInt():
	return int(input().strip())

def readList():
	return list(map(int, input().strip().split()))

def solve(N, arr):
	arr.sort()
	for (a, b) in zip(arr, arr[1:]):
		if b - a > 1:
			return False
	return True
t = readInt()
for i in range(t):
	N = readInt()
	arr = readList()
	print('YES' if solve(N, arr) else 'NO')


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


for s in [*open(0)][2::2]:
	a = set(map(int, s.split()))
	print('YNEOS'[max(a) - min(a) + 1 > len(a)::2])


import math
ls = lambda : list(map(int, input().split()))
ip = lambda : int(input())
sip = lambda : input()
r = lambda a: range(a)
lcm = lambda a, b: abs(a * b) // math.gcd(a, b)
t = ip()
for _ in r(t):
	n = ip()
	a = ls()
	a = sorted(a)
	yes = True
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			print('NO')
			yes = False
			break
	if yes:
		print('YES')


t = int(input())
a = []
b = []
for i in range(0, t):
	w = int(input())
	i = 0
	a = a + [int(a) for a in input().split()]
	a = sorted(a)
	for k in range(1, w):
		if a[k] - a[k - 1] > 1:
			i = i + 1
	if i == 0:
		b = b + ['YES']
	else:
		b = b + ['NO']
	del a[:]
for i in b:
	print(i)


import sys
from math import sqrt, gcd, ceil, log
from collections import defaultdict, Counter, deque
input = sys.stdin.readline
read = lambda : list(map(int, input().strip().split()))

def main():
	for _ in range(int(input())):
		n = int(input())
		arr = read()
		arr.sort()
		f = 1
		for i in range(n - 1):
			if not (arr[i + 1] - 1 == arr[i] or arr[i] == arr[i + 1]):
				f = 0
				break
		if f:
			print('YES')
		else:
			print('NO')
main()


for _ in range(int(input())):
	am = int(input())
	arr = list(map(int, input().split()))
	fl = True
	arr.sort()
	for i in range(am - 1):
		if arr[i + 1] - arr[i] > 1:
			fl = False
			break
	if fl:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	prev = l[0]
	flag = False
	for i in range(1, n):
		if l[i] - prev > 1:
			flag = True
			break
		else:
			prev = l[i]
	print('NO' if flag else 'YES')


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


for i in range(int(input())):
	length = int(input())
	array = list(map(int, input().split()))
	array.sort()
	for j in range(1, length):
		if array[j] - array[j - 1] > 1:
			print('NO')
			break
	else:
		print('YES')


from sys import stdin
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = sorted(map(int, stdin.readline().split()))
	res = 'YES'
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			res = 'NO'
			break
	print(res)


import math
from collections import Counter
from math import factorial as fact
from collections import defaultdict
import sys

def inpint():
	return int(input())

def inpstr():
	return str(input())

def inparr():
	return list(map(int, input().strip().split()))

def inptup():
	return map(int, input().strip().split())
for _ in range(inpint()):
	n = inpint()
	a = inparr()
	a.sort()
	lol = a[0]
	flag = False
	for i in range(1, n):
		if lol == a[i]:
			pass
		elif lol + 1 == a[i]:
			lol = a[i]
		else:
			flag = True
			break
	if flag:
		print('NO')
	else:
		print('YES')


def removeSmallest(length, nums):
	popped = 0
	nums.sort()
	if len(nums) == 1:
		return 'YES'
	for i in range(length - 1):
		if not abs(nums[i] - nums[i + 1]) <= 1:
			break
		if i == length - 2:
			return 'YES'
	return 'NO'
for i in range(int(input())):
	length = int(input())
	nums = [int(i) for i in input().split(' ')]
	print(removeSmallest(length, nums))


for i in range(int(input())):
	n = int(input())
	num = list(map(int, input().split()))
	num.sort()
	pre = num.pop(0)
	ans = True
	for i in num:
		if i - pre > 1:
			ans = False
			break
		pre = i
	if ans:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	f = 0
	j = 0
	i = 1
	while i < n:
		if abs(ar[i] - ar[j]) <= 1:
			i += 1
			j += 1
			f = 0
		else:
			f = 1
			break
	if f:
		print('NO')
	else:
		print('YES')


tc = int(input())
while tc > 0:
	tc = tc - 1
	n = int(input())
	k = list(map(int, input().split()))
	l = set(k)
	if max(l) - min(l) + 1 == len(l):
		print('YES')
	else:
		print('NO')


t = int(input())
for t_c in range(t):
	n = int(input())
	a = [int(i) for i in input().split(' ')]
	a.sort()
	prev = a[0]
	possible = True
	for i in range(1, len(a)):
		cur = a[i]
		if cur - prev > 1:
			possible = False
			break
		prev = cur
	if possible:
		print('YES')
	else:
		print('NO')


def main():
	for case in range(int(input())):
		n = int(input())
		arr = list(map(int, input().split()))
		arr.sort()
		for i in range(n - 1):
			if arr[i + 1] - arr[i] > 1:
				print('NO')
				break
		else:
			print('YES')
main()


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	work = True
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) > 1:
			work = False
			break
	if work:
		print('YES')
	else:
		print('NO')
t = int(input())
for test in range(t):
	solve()


for n in range(int(input())):
	input()
	s = input().split()
	a = set(map(int, s))
	b = set(map(lambda x: int(x) + 1, s))
	c = a - b
	print('YNEOS'[len(c) > 1::2])


t = int(input())
for _ in range(t):
	n = int(input())
	xs = list(map(int, input().split()))
	xs.sort()
	for (x, y) in zip(xs, xs[1:]):
		if y - x >= 2:
			break
	else:
		print('YES')
		continue
	print('NO')


t = int(input())
for _ in range(t):
	n = input()
	li = list(map(int, input().split()))
	cnt = 0
	for i in range(min(li), max(li) + 1):
		if i not in li:
			cnt = 1
			break
	if cnt == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	s.sort()
	p = 1
	for i in range(n - 1):
		if s[i + 1] - s[i] > 1:
			p = 0
			break
	if p == 1:
		print('YES')
		continue
	print('NO')


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


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


t = int(input())
for u in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort(reverse=True)
	otv = True
	for i in range(n - 1):
		if a[i] - a[i + 1] > 1:
			otv = False
	if otv:
		print('YES')
	else:
		print('NO')


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


import sys
input = sys.stdin.readline
T = int(input())
for testcase in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	while True:
		if len(a) == 1:
			break
		if a[1] - a[0] > 1:
			break
		del a[0]
	if len(a) == 1:
		print('YES')
	else:
		print('NO')


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


import math
t = int(input())
for _ in range(t):
	n = int(input())
	nums = [int(i) for i in input().split(' ')]
	nums.sort()
	can = True
	for i in range(len(nums) - 1):
		if nums[i] + 1 < nums[i + 1]:
			can = False
	print('YES' if can else 'NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	if n == 1:
		print('YES')
	else:
		i = 0
		flag = True
		while flag and len(a) > 1:
			if abs(a[i + 1] - a[i]) <= 1:
				if a[i + 1] < a[i]:
					del a[i + 1]
				else:
					del a[i]
			else:
				i += 1
			if i == len(a) - 1:
				flag = False
		if len(a) == 1:
			print('YES')
		else:
			print('NO')


import sys

def valid_array(array):
	array.sort()
	for i in range(1, len(array)):
		if abs(array[i] - array[i - 1]) > 1:
			return False
	return True
t = int(sys.stdin.readline())
for i in range(t):
	n = int(sys.stdin.readline())
	array = list(map(int, sys.stdin.readline().split()))
	if valid_array(array):
		print('YES')
	else:
		print('NO')


def remove_smallest(arr):
	for i in range(len(arr) - 1):
		if abs(arr[i] - arr[i + 1]) > 1:
			return 'NO'
	return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	assert n == len(arr)
	arr.sort()
	print(remove_smallest(arr))


from sys import stdin, stdout
import math
from collections import Counter, defaultdict
LI = lambda : list(map(int, input().split()))
MAP = lambda : map(int, input().split())
IN = lambda : int(input())
S = lambda : input()

def case():
	n = IN()
	a = sorted(LI())
	for i in range(n - 1):
		if a[i + 1] - a[i] >= 2:
			print('NO')
			return
	print('YES')
for _ in range(IN()):
	case()


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


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


import sys
lines = sys.stdin.read().splitlines()
lincnt = -1

def input():
	global lincnt
	lincnt += 1
	return lines[lincnt]

def solve():
	input()
	l = list(sorted(map(int, input().split())))
	for i in range(len(l) - 1):
		if l[i + 1] - l[i] > 1:
			print('NO')
			return
	print('YES')
for _ in range(int(input())):
	solve()


t = int(input())
while t:
	n = int(input())
	l = []
	l = list(map(int, input().split()))
	l.sort()
	f = 0
	i = 0
	while i < len(l) - 1:
		if abs(l[i] - l[i + 1]) <= 1:
			l.pop(0)
		else:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	num = sorted(list(map(int, input().split())))
	a = 0
	for i in range(n - 1):
		a = max(a, num[i + 1] - num[i])
	if a == 0 or a == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for t_i in range(t):
	input()
	a = list(map(int, input().split()))
	a.sort()
	valid = True
	for i in range(len(a) - 1):
		if a[i + 1] - a[i] > 1:
			valid = False
			break
	if valid:
		print('YES')
	else:
		print('NO')


a = int(input())
for i in range(a):
	m = int(input())
	ans = 'YES'
	arr = list(map(int, input().split()))
	arr.sort()
	while len(arr) > 1:
		if arr[1] - arr[0] <= 1:
			arr.remove(arr[0])
		else:
			ans = 'NO'
			break
	print(ans)


for _ in range(int(input())):
	N = int(input())
	seq = list(map(int, input().split()))
	seq.sort()
	for i in range(1, N):
		if seq[i] - seq[i - 1] > 1:
			print('NO')
			break
	else:
		print('YES')


from sys import stdin
input = lambda : stdin.readline().strip()
from math import ceil, sqrt, factorial, gcd
from collections import deque
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	f = 1
	for i in range(1, n):
		if l[i] - l[i - 1] > 1:
			f = 0
			break
	if f:
		print('YES')
	else:
		print('NO')


T = int(input())
for t in range(T):
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort()
	i = 0
	while i < n:
		k = i
		j = i + 1
		if j == n:
			break
		if arr[i] - arr[j] == 1 or arr[i] - arr[j] == -1 or arr[i] - arr[j] == 0:
			arr.remove(min(arr[i], arr[j]))
			i = k
			n = n - 1
		else:
			i = i + 1
	if len(arr) == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	f = True
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			f = False
	print('YES' if f is True else 'NO')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)

def toord(c):
	return ord(c) - ord('a')

def lcm(a, b):
	return a * b // lcm(a, b)
mod = 998244353
INF = float('inf')
from math import factorial, sqrt, ceil, floor, gcd
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def main():
	for _ in range(N()):
		n = N()
		arr = RLL()
		arr.sort(reverse=1)
		for i in range(1, n):
			if arr[i] < arr[i - 1] - 1:
				print('NO')
				break
		else:
			print('YES')
main()


def removeSmallest():
	a.sort()
	i = 1
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			return 'NO'
	return 'YES'
t = int(input())
for case in range(t):
	n = int(input())
	a = [int(x) for x in input().rstrip().split(' ')]
	print(removeSmallest())


t = int(input())
while t > 0:
	n = int(input())
	x = list(map(int, input().split(' ')))
	x.sort()
	i = 0
	y = True
	while i <= n - 2:
		if x[i] >= x[i + 1] and x[i] - x[i + 1] <= 1:
			x.pop(i + 1)
		elif x[i] < x[i + 1] and x[i + 1] - x[i] <= 1:
			x.pop(i)
		else:
			y = False
			break
		n -= 1
	if y == True:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	nums = list(map(int, input().split()))
	nums.sort()
	flag = 0
	if n == 1:
		print('YES')
		flag = 1
	for i in range(1, n):
		if nums[i] - nums[i - 1] > 1:
			flag = 2
			break
	if flag == 0:
		print('YES')
	elif flag == 2:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	ok = 'YES'
	for x in range(1, n):
		if a[x] - a[x - 1] > 1:
			ok = 'NO'
	print(ok)


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	k = 0
	for i in range(1, len(a)):
		if abs(a[i] - a[i - 1]) > 1:
			k = 1
			print('NO')
			break
	if k == 0:
		print('YES')


from sys import *
input = stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print('YES')
	else:
		l.sort()
		c = 0
		for i in range(n - 1):
			if l[i + 1] - l[i] > 1:
				c = -1
				break
		if c == -1:
			print('NO')
		else:
			print('YES')


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 'YES'
	for elem in range(n - 1):
		if abs(a[elem] - a[elem + 1]) > 1:
			ans = 'NO'
			break
	print(ans)


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


t = int(input())
for i in range(t):
	n = int(input())
	values = sorted(map(int, input().split()))
	for i in range(1, n):
		if values[i] - values[i - 1] > 1:
			print('NO')
			break
	else:
		print('YES')


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


t = int(input())
arr = [0] * 100
while t:
	n = int(input())
	arr[:n] = map(int, input().split(' '))
	arr[:n] = sorted(arr[:n])
	flag = 1
	for i in range(1, n):
		if abs(arr[i] - arr[i - 1]) > 1:
			flag = 0
			break
	if flag:
		print('YES')
	else:
		print('NO')
	t -= 1


def solve(arr, n):
	if n == 1:
		return 'YES'
	arr.sort()
	j = 1
	while j < n:
		if arr[j] - arr[j - 1] > 1:
			return 'NO'
		j += 1
	return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(solve(arr, n))


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	yep = False
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			print('NO')
			yep = True
			break
	if not yep:
		print('YES')


from collections import deque
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if len(a) == 1:
		print('YES')
		continue
	a.sort()
	c = True
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) > 1:
			print('NO')
			c = False
			break
	if c:
		print('YES')


def f():
	t = int(input())
	for _ in range(t):
		n = int(input())
		arr = list(map(lambda x: int(x), input().split(' ')))
		arr.sort()
		i = 1
		while i < len(arr):
			if arr[i] > arr[i - 1] + 1:
				print('NO')
				break
			i += 1
		if i == len(arr):
			print('YES')
f()


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


from fractions import Fraction
import bisect
import os
import io
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate
from queue import Queue

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

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
t = 1
t = iinput()
for _ in range(t):
	n = iinput()
	a = list(set(rlinput()))
	a.sort()
	flag = True
	for i in range(1, len(a)):
		if a[i] - a[i - 1] != 1:
			flag = False
			break
	print(['NO', 'YES'][flag])


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
for _ in range(int(input()) if True else 1):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	pos = True
	for i in range(1, n):
		if a[i] - a[i - 1] <= 1:
			continue
		else:
			pos = False
			break
	print('YES' if pos else 'NO')


t = int(input())
for test_case in range(t):
	n = int(input())
	a = [int(e) for e in input().split()]
	a.sort()
	ok = True
	for i in range(n - 1):
		if a[i + 1] - a[i] >= 2:
			ok = False
	print('YES' if ok else 'NO')


def rem(arr, n):
	arr.sort()
	while True:
		if len(arr) == 1:
			return 'YES'
		if arr[1] - arr[0] <= 1:
			arr.remove(arr[0])
		else:
			break
	return 'NO'
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(rem(arr, n))


import math
for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	for i in range(len(l) - 1):
		if math.fabs(l[i] - l[i + 1]) <= 1:
			n -= 1
	if n == 1:
		print('YES')
	else:
		print('NO')


def mi():
	return map(int, input().split())

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))

def si():
	return input().split()
t = ii()
for _ in range(t):
	n = ii()
	a = li()
	a.sort()
	ans = True
	for i in range(1, n):
		if abs(a[i] - a[i - 1]) > 1:
			ans = False
			break
	if not ans:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	x = int(input())
	a = list(map(int, input().split()))
	a.sort()
	c = 0
	b = [0] * (len(a) - 1)
	for j in range(len(a) - 1):
		b[j] = a[j + 1] - a[j]
	for item in b:
		if item > 1:
			continue
		else:
			c += 1
	if c == len(b):
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	ans = 'YES'
	for i in range(0, n - 1):
		if abs(a[i] - a[i + 1]) > 1:
			ans = 'NO'
			break
	print(ans)
	t -= 1


def solve(a):
	a = sorted(a)
	for i in range(len(a) - 1):
		if a[i + 1] > a[i] + 1:
			return 'NO'
	return 'YES'
t = int(input())
for dum in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	res = solve(a)
	print(res)


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	f = 1
	a = sorted(map(int, stdin.readline().split()))
	for (v, v1) in zip(a, a[1:]):
		if v1 - v > 1:
			f = 0
			break
	print('YES' if f else 'NO')


import sys
import math
from collections import Counter
import heapq
try:
	for _ in range(int(input())):
		n = int(input())
		arr = [int(i) for i in input().split()]
		arr.sort()
		flg = 0
		for i in range(1, n):
			if arr[i] - arr[i - 1] > 1:
				flg = 1
				break
		if flg == 1:
			print('NO')
		else:
			print('YES')
except EOFError as e:
	print(e)


def check():
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			return False
	return True
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = sorted(map(int, input().split()))
	if check():
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	a = int(input())
	b = list(map(int, input().split()))
	b = sorted(b)
	thing = True
	for i in range(a - 1):
		if b[i + 1] - b[i] > 1:
			thing = False
	print('YES' if thing == True else 'NO')


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ans = True
	for i in range(1, n):
		ans &= l[i] - l[i - 1] <= 1
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for test in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	ans = 'YES'
	for i in range(n - 1):
		if arr[i + 1] - arr[i] > 1:
			ans = 'NO'
			break
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	str = input()
	values = [int(x) for x in str.split(' ')]
	values.sort()
	for (x, y) in zip(values[1:], values):
		if x - y > 1:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for i in range(t):
	p = 0
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print('YES')
		continue
	else:
		a = sorted(a)
		for j in range(n - 1):
			if a[j + 1] - a[j] > 1:
				p = 1
				break
	if p == 1:
		print('NO')
	else:
		print('YES')


t = int(input())

def fun1(a, n):
	for b in range(1, n):
		if a[b] - a[b - 1] > 1:
			return 'NO'
	return 'YES'
for i in range(0, t):
	n = int(input())
	a = sorted(list(map(int, input().split(' '))))
	print(fun1(a, n))


t = int(input())
for i in range(t):
	n = int(input())
	s = input().split()
	for i in range(n):
		s[i] = int(s[i])
	s.sort()
	for i in range(n - 1):
		if s[i + 1] - s[i] > 1:
			print('NO')
			break
	else:
		print('YES')


import math
T = int(input())
while T > 0:
	N = int(input())
	list1 = [int(x) for x in input().split()]
	list1 = sorted(list1)
	flag = 0
	for i in range(len(list1) - 1):
		if list1[i + 1] - list1[i] > 1:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')
	T -= 1


n = int(input())
x = []
for i in range(1, n * 2 + 1):
	if i % 2 == 0:
		a = list(map(int, input().split()))
		x.append(a)
	else:
		b = input()
for ad in x:
	ad.sort()
	c = list(dict.fromkeys(ad))
	d = list(range(min(ad), max(ad) + 1))
	if c == d:
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
import math
from decimal import *
getcontext().prec = 30
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	n = int(input().rstrip())
	l = list(map(int, input().rstrip().split(' ')))
	l.sort()
	r = 'YES'
	for i in range(1, n):
		if l[i] - l[i - 1] > 1:
			r = 'NO'
			break
	print(r)


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


def solve(n, a):
	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(solve(n, a))


t = int(input())
while t:
	t -= 1
	input()
	nums = list(map(int, input().split()))
	while len(nums) > 1:
		min = nums[0]
		count = 0
		for num in nums:
			if num < min:
				min = num
				count = 1
			elif num == min:
				count += 1
		for _ in range(count - 1):
			nums.remove(min)
			count -= 1
		if len(nums) == 1 or min + 1 in nums:
			nums.remove(min)
		else:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
while t:
	n = int(input())
	li = set(list(map(int, input().split())))
	print('NO' if max(li) - min(li) >= len(li) else 'YES')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	lst = sorted(list(map(int, input().split())))
	k = True
	for i in range(len(lst) - 1):
		if abs(lst[i] - lst[i + 1]) > 1:
			k = False
			break
	if k:
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	k = int(input())
	arr = map(int, input().split())
	arr = sorted(list(arr))
	k = 0
	for j in range(len(arr) - 1):
		if arr[j + 1] - arr[j] <= 1:
			k += 1
	if k == len(arr) - 1:
		print('YES')
	else:
		print('NO')


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


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


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	flag = 1
	if len(l) == 1:
		print('YES')
	elif len(l) == 0:
		print('NO')
	else:
		for i in range(len(l) - 1):
			if l[i + 1] - l[i] > 1:
				flag = 0
		if flag == 1:
			print('YES')
		else:
			print('NO')


from sys import stdin, stdout
test = int(stdin.readline())
for _ in range(test):
	N = int(stdin.readline())
	a = [int(x) for x in input().split()]
	a.sort()
	flag = True
	for i in range(N - 1):
		if a[i + 1] - a[i] > 1:
			flag = False
			break
	print('YES') if flag else print('NO')


import math
num_cases = int(input())
for _ in range(num_cases):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	arr.sort()
	found = False
	for i in range(n - 1):
		if arr[i + 1] > arr[i] + 1:
			found = True
			break
	if found:
		print('NO')
	else:
		print('YES')


import sys
import math
from collections import defaultdict, Counter, deque

def solve(test):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	if n == 1:
		print('YES')
		return
	for i in range(1, n):
		if a[i] - a[i - 1] <= 1:
			continue
		else:
			print('NO')
			return
	print('YES')
test_cases = int(input())
for t in range(1, test_cases + 1):
	solve(t)


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


T = int(input())
for _ in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	A.sort()
	ans = True
	for i in range(N - 1):
		if A[i + 1] - A[i] > 1:
			ans = False
	if ans:
		print('YES')
	else:
		print('NO')


def removeSmallest():
	for t in range(int(input())):
		n = int(input())
		s = sorted([int(x) for x in input().split()])
		i = 0
		flag = 0
		while i < n - 1:
			if abs(s[i] - s[i + 1]) > 1:
				print('NO')
				flag = 1
				break
			i = i + 1
		if flag == 0:
			print('YES')
removeSmallest()


MOD = 1000000007
from collections import defaultdict as dd, Counter, deque

def si():
	return input()

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))

def mi():
	return map(int, input().split())

def out(v):
	print(v)

def spout():
	print(v, end=' ')

def d2b(n):
	return bin(n).replace('0b', '')

def twod(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def vow():
	return ['a', 'e', 'i', 'o', 'u']

def let():
	return [chr(i) for i in range(97, 123)]

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ispow2(x):
	return x and (not x & x - 1)

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)
t = ii()
while t:
	t -= 1
	n = ii()
	a = li()
	if n == 1:
		print('YES')
	else:
		a.sort()
		f = 0
		for i in range(n - 1):
			if a[i + 1] - a[i] > 1:
				f = 1
				break
		if f == 0:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	b = a[:]
	for i in range(n - 1):
		if a[i + 1] - a[i] <= 1:
			b.remove(a[i])
	if len(b) == 1:
		print('YES')
	else:
		print('NO')


for i in [*open(0)][2::2]:
	_ = {*map(int, i.split())}
	print('YNEOS'[max(_) - min(_) >= len(_)::2])


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


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


def BubbleSort(tab):
	n = len(tab)
	for i in range(n - 1):
		for j in range(0, n - i - 1):
			if tab[j] > tab[j + 1]:
				(tab[j], tab[j + 1]) = (tab[j + 1], tab[j])
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	BubbleSort(a)
	for j in range(n):
		try:
			if abs(a[j] - a[j + 1]) > 1:
				print('NO')
				break
		except:
			print('YES')


for _ in range(int(input())):
	a = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	flag = True
	for i in range(len(arr) - 1):
		if arr[i] == arr[i + 1] or arr[i] + 1 == arr[i + 1]:
			continue
		else:
			flag = False
			break
	if flag == True:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	x = sorted(list(map(int, input().split())))

	def main(n, x):
		for i in range(n - 1):
			if x[i + 1] - x[i] > 1:
				return 'NO'
		return 'YES'
	print(main(n, x))


from sys import stdin
input = stdin.readline

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


t = int(input())
for _ in range(t):
	input()
	lst = list(map(int, input().split()))
	lst.sort()
	error = False
	for i in range(len(lst) - 1):
		if lst[i] + 1 < lst[i + 1]:
			error = True
			break
	if error:
		print('NO')
	else:
		print('YES')


def gogo(ls):
	ls.sort()
	for i in range(0, len(ls) - 1):
		if abs(ls[i] - ls[i + 1]) > 1:
			return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	ls = list(map(int, input().split()))
	print(gogo(ls))


t = int(input())
while t:
	n = int(input())
	arr = list(map(int, input().split()))
	arr = sorted(arr)
	f = 1
	if n != 1:
		for i in range(1, n):
			if abs(arr[i] - arr[i - 1]) > 1:
				f = 0
				break
	if f:
		print('YES')
	else:
		print('NO')
	t -= 1


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


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


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


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = 'YES'
	if len(arr) == 1:
		print(ans)
	else:
		arr.sort()
		for x in range(len(arr) - 1):
			if abs(arr[x] - arr[x + 1]) > 1:
				ans = 'NO'
				break
		print(ans)


for _ in range(int(input())):
	a = int(input())
	b = [int(i) for i in input().split()]
	b.sort()
	fl = 0
	for i in range(a - 1):
		if b[i + 1] - b[i] > 1:
			fl = 1
	if fl:
		print('NO')
	else:
		print('YES')


t = int(input())

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


for _ in range(int(input())):
	n = int(input())
	nums = list(map(int, input().split()))
	nums.sort()
	found = False
	for i in range(n - 1):
		if abs(nums[i] - nums[i + 1]) > 1:
			print('NO')
			found = True
			break
	if not found:
		print('YES')


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


t = int(input())
i = 0
while i < t:
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	flag = True
	for x in range(1, n):
		if l[x] - l[x - 1] > 1:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')
	i += 1


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


for _ in range(int(input())):
	n = int(input())
	nums = list(map(int, input().split()))
	nums.sort()
	flag = True
	for i in range(n - 1):
		if nums[i + 1] - nums[i] > 1:
			flag = False
			print('NO')
			break
	if flag:
		print('YES')


def possible(arr, n):
	if n == 1:
		return 'YES'
	arr.sort()
	for i in range(n - 1):
		if arr[i + 1] - arr[i] >= 2:
			return 'NO'
	return 'YES'
result = []
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	result.append(possible(arr, n))
for i in range(t):
	print(result[i])


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
tests = inp()
testCount = 0
while testCount < tests:
	n = inp()
	arr = inlt()
	arr.sort()
	i = 0
	while i < n - 1:
		if arr[i + 1] > arr[i] + 1:
			print('NO')
			i += n
		else:
			i += 1
	if i == n - 1:
		print('YES')
	testCount += 1


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


for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	cnt = 0
	lst.sort()
	if len(lst) == 1:
		print('YES')
	else:
		for i in range(1, n - 1):
			if lst[i] - lst[i - 1] > 1 or lst[i + 1] - lst[i] > 1:
				cnt += 1
		if lst[n - 1] - lst[n - 2] > 1:
			cnt += 1
		if lst[1] - lst[0] > 1:
			cnt += 1
		if cnt >= 1:
			print('NO')
		else:
			print('YES')


t = int(input())
for i in range(t):
	count = 0
	n = int(input())
	arr = list(map(int, input().split()))
	if len(arr) == 1:
		print('YES')
	else:
		arr.sort()
		for i in range(len(arr) - 1):
			if abs(arr[i] - arr[i + 1]) <= 1:
				arr[i] = 0
		for i in arr:
			if i > 0:
				count += 1
		if count == 1:
			print('YES')
		else:
			print('NO')


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


for i in ' ' * int(input()):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	f = 1
	pri = l[0]
	for i in l:
		if i - pri > 1:
			f = 0
			break
		pri = i
	print(['NO', 'YES'][f])


t = int(input())
for test in range(t):
	n = int(input())
	l = list(set(map(int, input().split())))
	n = len(l)
	if len(l) == 1:
		print('YES')
		continue
	l.sort()
	flag = True
	for i in range(n - 1):
		if l[i + 1] - l[i] > 1:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


xyz = input
t = int(xyz())
for t1 in [0] * t:
	n = int(xyz())
	nums = list(map(int, xyz().split()))
	nums.sort()
	counter = 0
	for i in range(len(nums) - 1):
		if nums[i + 1] - nums[i] <= 1:
			pass
		else:
			counter += 1
	if counter >= 1:
		print('NO')
	else:
		print('YES')


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


T = int(input())
for t in range(0, T):
	n = int(input())
	arr = [0] + sorted(map(int, input().split()))
	res = 1
	for i in range(1, n):
		if abs(arr[i] - arr[i + 1]) > 1:
			res = 0
	if res == 0:
		print('NO')
	else:
		print('YES')


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for i in range(t):
	n = inp()
	mylist = inlt()
	mylist.sort()
	counter = 0
	for k in range(n - 1):
		if counter == 0:
			if mylist[k + 1] - mylist[k] > 1:
				print('NO')
				counter = 1
	if counter == 0:
		print('YES')


import os
import math
import sys
from collections import defaultdict

def r():
	return int(input())

def rm():
	return map(int, input().split())

def rl():
	return list(map(int, input().split()))
for _ in range(r()):
	n = r()
	a = rl()
	a.sort()
	res = True
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			res = False
			break
	if res:
		print('YES')
	else:
		print('NO')


test = int(input())
for _ in range(test):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	ans = False
	for i in range(1, n):
		if arr[i] - arr[i - 1] > 1:
			print('NO')
			ans = True
			break
	if not ans:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l = sorted(l)
	m = sorted(l)
	p = len(l)
	for x in range(p - 1):
		if l[x + 1] - l[x] <= 1:
			m.remove(l[x])
		else:
			break
	print('YES') if len(m) == 1 else print('NO')


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


import io
import os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def get_str():
	return input().decode().strip()

def rint():
	return map(int, input().split())

def oint():
	return int(input())
t = oint()
for _ in range(t):
	n = oint()
	a = list(rint())
	a.sort()
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) > 1:
			print('NO')
			break
	else:
		print('YES')


from collections import defaultdict as dd
from collections import Counter as ctr
from sys import stdin, stdout
from math import log, sqrt
from itertools import permutations
from itertools import combinations
from bisect import bisect_left, insort
for t in range(int(stdin.readline().strip())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	flag = True
	for i in range(1, n):
		if abs(a[i] - a[i - 1]) > 1:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


def function(n, arr):
	if n <= 1:
		return 'YES'
	arr.sort()
	for i in range(n - 1):
		if arr[i + 1] - arr[i] >= 2:
			return 'NO'
	return 'YES'
t = int(input())
while t:
	n = int(input())
	arr = list(map(int, input().rstrip().split()))
	print(function(n, arr))
	t -= 1


import sys

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

def iinput():
	return int(input())

def rinput():
	return map(int, input().split())

def get_list():
	return list(rinput())
mod = int(1000000000.0) + 7
for _ in range(iinput()):
	n = iinput()
	a = get_list()
	a.sort()
	flag = True
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


num_queries = int(input())
for query in range(num_queries):
	arr_len = int(input())
	arr = sorted([int(x) for x in str(input()).split()])
	length = len(arr)
	for idx in range(length - 1):
		if arr[idx + 1] - arr[idx] <= 1:
			length -= 1
	if length == 1:
		print('YES')
	else:
		print('NO')


nCases = int(input())
for _ in range(nCases):
	nNums = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	canDo = True
	for i in range(nNums - 1):
		if abs(arr[i] - arr[i + 1]) > 1:
			canDo = False
			break
	if canDo:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	_ = input()
	[*a] = map(int, input().split())
	a.sort()
	print(['NO', 'YES'][all((y - x <= 1 for (x, y) in zip(a[0:], a[1:])))])


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	s = set(l)
	if max(s) - min(s) < len(s):
		print('YES')
	else:
		print('NO')


t = int(input())
for tt in range(t):
	n = int(input())
	a = [int(x) for x in input().split(' ')]
	b = list(set(a))
	b.sort()
	if b[-1] - b[0] + 1 == len(b):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	f = 0
	j = 1
	while len(l) > 1:
		if l[j] - l[j - 1] == 0 or l[j] - l[j - 1] == 1:
			l.remove(l[j - 1])
		else:
			f = 1
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


def quick(arr, s, e):
	p = arr[e]
	i = s - 1
	for j in range(s, e):
		if arr[j] < p:
			i += 1
			(arr[j], arr[i]) = (arr[i], arr[j])
	(arr[i + 1], arr[e]) = (arr[e], arr[i + 1])
	return i + 1

def sort(arr, s, e):
	if s < e:
		p = quick(arr, s, e)
		sort(arr, s, p - 1)
		sort(arr, p + 1, e)

def remove(arr, n):
	if n == 1:
		return 'YES'
	sort(arr, 0, len(arr) - 1)
	for i in range(n - 1):
		if arr[i + 1] - arr[i] > 1:
			return 'NO'
	return 'YES'
a = int(input())
for _ in range(a):
	n = int(input())
	li = list(map(int, input().split()))
	print(remove(li, n))


def remove_smallest(a):
	while True:
		if len(a) == 1:
			return 'YES'
		elif abs(a[0] - a[1]) <= 1:
			a.pop(0)
		else:
			return 'NO'
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split(' ')))
	a = set(a)
	a = list(a)
	a.sort()
	print(remove_smallest(a))


for __ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort()
	flag = True
	for i in range(1, len(arr), 1):
		if arr[i] - arr[i - 1] > 1:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')


for i in range(int(input())):
	n = int(input())
	alist = list(map(int, input().split()))
	aset = set(alist)
	alist = list(aset)
	alist.sort()
	flag = 1
	if len(alist) == 1:
		print('YES')
	else:
		for j in range(len(alist) - 1):
			if alist[j + 1] - alist[j] != 1:
				flag = 0
		if flag == 0:
			print('NO')
		else:
			print('YES')


n = int(input())
for i in range(0, n):
	input()
	l = list(map(int, input().split(' ')))
	l.sort()
	b = True
	for j in range(1, len(l)):
		if l[j] - l[j - 1] > 1:
			print('NO')
			b = False
			break
	if b:
		print('YES')


def sol(l):
	l.sort()
	if len(l) <= 1:
		return 'YES'
	else:
		for i in range(len(l) - 1):
			if abs(l[i] - l[i + 1]) > 1:
				return 'NO'
	return 'YES'
t = int(input())
for _ in range(t):
	n = input()
	l = list(map(int, input().split()))
	ans = sol(l)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	visited = [False] * n
	arr.sort()
	for i in range(n):
		if not visited[i]:
			a = arr[i]
			for j in range(i + 1, n):
				if arr[j] - a <= 1:
					visited[i] = True
					break
	cnt = 0
	for i in visited:
		if not i:
			cnt += 1
	if cnt == 1:
		print('YES')
	else:
		print('NO')


a = int(input())
for _ in range(a):
	x = int(input())
	li = list(map(int, input().split()))
	if x == 1:
		print('YES')
		continue
	li.sort()
	y = li[0]
	for i in li[1:]:
		if i - y > 1:
			print('NO')
			break
		y = i
	else:
		print('YES')


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


for _ in range(int(input())):
	n = int(input())
	arr = list((int(i) for i in input().split()))
	if n == 1:
		print('YES')
	else:
		arr.sort()
		flag = True
		for i in range(1, n):
			if abs(arr[i] - arr[i - 1]) > 1:
				flag = False
				break
		if flag:
			print('YES')
		else:
			print('NO')


def check(array):
	while len(array) > 1:
		if array[1] - array[0] <= 1:
			array.pop(0)
		else:
			break
	return 'YES' if len(array) == 1 else 'NO'
t = int(input())
answers = []
for i in range(t):
	n = int(input())
	array = [int(x) for x in input().split()]
	array.sort()
	answers.append(check(array))
for a in answers:
	print(a)


results = []
for t in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	result = 'YES'
	for i in range(1, n):
		if l[i] - l[i - 1] > 1:
			result = 'NO'
			break
	results.append(result)
print('\n'.join(results))


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


t = int(input())
for _ in range(t):
	n = int(input())
	l1 = list(map(int, input().split()))
	l1.sort()
	l2 = l1[:]
	for i in range(n):
		if l2.count(l1[i]) + l2.count(l1[i] + 1) + l2.count(l1[i] - 1) > 1:
			l2.remove(l1[i])
	if len(l2) == 1:
		print('YES')
	else:
		print('NO')


def main(arr):
	l = list(sorted(arr))
	for i in range(1, len(l)):
		if abs(l[i - 1] - l[i]) > 1:
			return False
	return True
t = int(input())
for p in range(t):
	n = int(input())
	s = str(input())
	l = list(map(int, s.split()))
	if main(l) == True:
		print('YES')
	else:
		print('NO')


def func(arr, n):
	arr.sort()
	for i in range(1, n):
		if arr[i] > arr[i - 1] + 1:
			return 'NO'
	return 'YES'

def main():
	for tc in range(int(input())):
		n = int(input())
		arr = [int(i) for i in input().split()]
		print(func(arr, n))
main()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	t = 0
	r = 0
	for i in range(n - 1):
		if a[i] - a[i + 1] > 1:
			t += 1
		else:
			r += 1
	if t > 0:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	l1 = int(input())
	l = sorted(list(map(int, input().split())))
	a = 0
	while a != len(l) - 1:
		if l[a + 1] - l[a] in [0, 1, -1]:
			l.pop(a)
			continue
		elif l[a + 1] - l[a] not in [0, 1, -1]:
			a += 1
			continue
		else:
			break
	if len(l) == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	A = [int(x) for x in input().split()]
	A.sort()
	if max((A[i] - A[i - 1] for i in range(1, n)), default=0) < 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for z in range(t):
	n = int(input())
	a = sorted([int(q) for q in input().split()])
	m = True
	for i in range(n - 1):
		j = a[i + 1] - a[i]
		if j > 1:
			print('NO')
			m = False
			break
	if m:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	k = True
	for i in range(len(a) - 1):
		if abs(a[i] - a[i + 1]) > 1:
			k = False
	if k:
		print('YES')
	else:
		print('NO')


n = int(input())
a = list()
ans = True
for _ in range(n):
	nint = input()
	a = [int(x) for x in input().split()]
	a.sort()
	for i in range(len(a) - 1):
		if abs(a[i + 1] - a[i]) > 1:
			ans = False
	print('YES') if ans else print('NO')
	ans = True


x = int(input())
for i in range(0, x):
	n = int(input())
	m = list(map(int, input().split()))[:n]
	m.sort()
	s = 0
	for j in range(1, n):
		if m[j] - m[j - 1] > 1:
			s = 1
			break
	if s:
		print('NO')
	else:
		print('YES')


import string
t = int(input())
for _ in range(t):
	pj = 0
	n = int(input())
	l = list(map(int, input().strip().split()))[:n]
	while len(l) != 1:
		q = min(l)
		if q + 1 in l or q - 1 in l or l.count(q) > 1:
			del l[l.index(q)]
		else:
			pj = 1
			print('NO')
			break
	if pj == 0:
		print('YES')
pass


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


t = int(input())
while t:
	t -= 1
	n = int(input())
	ar = [int(i) for i in input().strip().split()]
	ar.sort()
	b = []
	if n == 1:
		print('YES')
	else:
		for i in range(n - 1):
			b.append(abs(ar[i] - ar[i + 1]))
		b.sort()
		if b[-1] > 1:
			print('NO')
		else:
			print('YES')


t = int(input())
for i in range(t):
	n = input()
	a = input().replace('(', '').replace(')', '').replace(',', '').split()
	a = list(map(int, a))
	b = sorted(list(set(a)))
	if max(b) - min(b) + 1 != len(b):
		print('NO')
	else:
		print('YES')


t = int(input())
n = [0] * t
a = [0] * t
for i in range(t):
	n[i] = int(input())
	a[i] = [0] * n[i]
	a[i] = list(map(int, input().split()))
for j in range(t):
	z = max(a[j])
	x = min(a[j])
	flag = 0
	for i in range(x, z):
		if i not in a[j]:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	d = dict()
	for x in a:
		if x in d.keys():
			d[x] += 1
		else:
			d[x] = 1
	a = list(d.keys())
	a.sort()
	ans = True
	for i in range(len(a) - 1):
		if a[i + 1] - a[i] != 1:
			ans = False
			break
	if ans == True:
		print('YES')
	else:
		print('NO')


from sys import stdin

def solve(arr, n):
	if n == 1:
		return 'YES'
	arr.sort()
	for i in range(1, n):
		if arr[i] - arr[i - 1] > 1:
			return 'NO'
	return 'YES'
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	arr = [int(x) for x in stdin.readline().split()]
	print(solve(arr, n))


test = int(input())
while test > 0:
	n = int(input())
	v = []
	st = input().split()
	for i in range(n):
		ele = int(st[i])
		v.append(ele)
	v.sort()
	impossible = False
	for i in range(n - 1):
		if v[i + 1] - v[i] > 1:
			impossible = True
	if impossible:
		print('NO')
	else:
		print('YES')
	test -= 1


T = int(input())
for t in range(T):
	burger = True
	n = int(input())
	arr = [int(x) for x in input().split(' ')]
	arr = sorted(arr)
	for i in range(1, n):
		if arr[i] - arr[i - 1] > 1:
			burger = False
			break
	if burger:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = [*map(int, input().split())]
	a.sort()
	case = True
	for i in range(n - 1):
		if a[i + 1] - a[i] >= 2:
			case = False
			print('NO')
			break
	if case:
		print('YES')


import time
from collections import deque

def inpt():
	return int(input())

def inpl():
	return list(map(int, input().split()))

def inpm():
	return map(int, input().split())

def solve():
	n = inpt()
	l = sorted(inpl())
	for i in range(1, n):
		if l[i] - l[i - 1] > 1:
			print('NO')
			return
	print('YES')
	return

def main():
	m = 10 ** 9 + 7
	t = int(input())
	while t:
		t -= 1
		solve()
main()


t = int(input())

def check(l, n):
	for i in range(1, n):
		if l[i] - l[i - 1] > 1:
			return False
	return True
for i in range(t):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	print('YES' if check(l, n) else 'NO')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	for idx in range(n - 1):
		if arr[idx + 1] - arr[idx] <= 1:
			arr[idx] = 0
		else:
			pass
	arr = list(set(arr))
	if len(arr) == 1:
		print('YES')
	elif arr[0] == 0 and len(arr) == 2:
		print('YES')
	else:
		print('NO')


n = int(input())
answer = ['' for i in range(n)]
for j in range(n):
	m = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	if m == 1:
		answer[j] = 'YES'
	for i in range(len(a) - 1):
		if abs(a[i] - a[i + 1]) > 1:
			answer[j] = 'NO'
			break
	else:
		answer[j] = 'YES'
print('\n'.join(answer))


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	i = 0
	flag = 0
	while i < n - 1:
		if abs(a[i] - a[i + 1]) > 1:
			flag = 1
			break
		i += 1
	if flag == 1:
		print('NO')
		continue
	print('YES')


for each in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	k = 0
	while len(a) > 1:
		if a[k + 1] - a[k] <= 1:
			a.remove(a[k])
		else:
			break
	if len(a) == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	ar = list(map(int, input().split()))
	if n == 1:
		print('YES')
	else:
		ar.sort()
		i = 0
		while len(ar) > 1:
			if abs(ar[i] - ar[i + 1]) <= 1:
				ar.pop(i)
			else:
				break
		if len(ar) == 1:
			print('YES')
		else:
			print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	numbers = list(map(int, input().split()))
	min_n = min(numbers)
	max_n = max(numbers)
	check = [False for j in range(max_n + 1)]
	for number in numbers:
		check[number] = True
	answer = True
	for j in range(min_n, max_n):
		if not check[j]:
			answer = False
			break
	if answer:
		print('YES')
	else:
		print('NO')


def func(arr, l):
	arr = sorted(arr)
	j = 1
	flag = 0
	for i in range(0, l - 1):
		if arr[j] - arr[i] == 1 or arr[j] - arr[i] == 0:
			i += 1
			j += 1
		else:
			flag += 1
	if flag > 0:
		print('NO')
	else:
		print('YES')
tc = int(input())
for i in range(tc):
	l = int(input())
	arr = list(map(int, input().rstrip().split()))
	result = func(arr, l)


import sys
t = int(input())
for _ in range(t):
	n = int(input())
	Data = [int(x) for x in input().split()]
	fl = False
	Data.sort()
	for i in range(1, n):
		if Data[i] - Data[i - 1] > 1:
			fl = True
	if fl:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	x = int(input())
	y = list(map(int, input().split()))
	q = y.copy()
	q.sort()
	y.sort()
	for i in range(x - 1):
		a = q[i]
		b = q[i + 1]
		c = b - a
		if abs(c) <= 1:
			y.remove(min(a, b))
	if len(y) == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	t = -1
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	prev = arr[0]
	found = False
	for num in arr:
		if num - prev > 1:
			print('NO')
			found = True
			break
		prev = num
	if not found:
		print('YES')


for i in range(int(input())):
	x = int(input())
	li = list(map(int, input().split()))
	if len(set(li)) == 1:
		print('YES')
	else:
		a = list(set(li))
		a.sort()
		c = 0
		for j in range(len(a) - 1):
			if abs(a[j] - a[j + 1]) > 1:
				c = 1
				break
		if c == 0:
			print('YES')
		else:
			print('NO')


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


import os
from collections import defaultdict, deque
is_dev = 'vscode' in os.environ
if is_dev:
	inF = open('in.txt', 'r')
	outF = open('out.txt', 'w')

def ins(r):
	return list(map(int, r.split(' ')))

def input_():
	if is_dev:
		return inF.readline()[:-1]
	else:
		return input()

def print_(data):
	if is_dev:
		outF.write(str(data) + '\n')
	else:
		print(data)
for _ in range(int(input_())):
	n = int(input_())
	a = ins(input_())
	a = set(a)
	a = sorted(list(a))
	if max(a) - min(a) + 1 == len(a):
		print_('YES')
	else:
		print_('NO')
if is_dev:
	outF.close()

	def compare_file():
		print(open('out.txt', 'r').read() == open('outactual.txt', 'r').read())
	compare_file()


t = int(input())
for _ in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	i = 0
	flag = True
	while i < n - 1:
		if abs(a[i] - a[i + 1]) <= 1:
			i += 1
			continue
		else:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


import math
import time
from collections import defaultdict, deque, Counter
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from queue import PriorityQueue
import sys
t = int(input())
for _ in range(t):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	a.sort()
	poss = True
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			poss = False
			break
	if poss:
		print('YES')
	else:
		print('NO')


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


rr = lambda : input().strip()
rri = lambda : int(rr())
rrm = lambda : [int(x) for x in rr().split()]
from sys import stdin, stdout, setrecursionlimit

def sol():
	n = rri()
	lis = rrm()
	lis.sort()
	l = lis[0]
	for i in lis:
		if i - l > 1:
			print('NO')
			return
		l = i
	print('YES')
	return

def main():
	T = rri()
	for t in range(1, T + 1):
		ans = sol()
main()


T = int(input())
for _ in range(0, T):
	n = int(input())
	s = [int(x) for x in input().split()]
	s.sort()
	ans = 'YES'
	for i in range(1, len(s)):
		if s[i] - s[i - 1] > 1:
			ans = 'NO'
			break
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	yes = True
	for i in range(1, len(l)):
		if l[i] - l[i - 1] > 1:
			yes = False
			break
	if yes:
		print('YES')
	else:
		print('NO')


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


from math import log2, ceil, floor
from collections import defaultdict, OrderedDict, Counter, deque
from heapq import heappush, heappop, heapify
import re

def inp():
	return input()

def list_inp():
	return list(map(int, input().split()))

def map_inp():
	return map(int, input().split())

def int_inp():
	return int(input())

def float_int():
	return float(input())

def isprime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
for _ in range(int_inp()):
	n = int_inp()
	l = list_inp()
	mn = min(l)
	mx = max(l)
	s = set(l)
	if len(s) == mx - mn + 1:
		print('YES')
	else:
		print('NO')


inp1 = int(input())
for i in range(inp1):
	inp2 = int(input())
	inp3 = list(map(int, input().split()))
	inp3.sort()
	for j in range(inp2 - 1):
		if abs(inp3[j] - inp3[j + 1]) > 1:
			print('NO')
			break
	else:
		print('YES')


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


t = int(input())
while t > 0:
	n = int(input())
	lst = list()
	lst = list(map(int, input().split()))
	lst.sort()
	pos = True
	for i in range(0, n - 1):
		if abs(lst[i] - lst[i + 1]) > 1:
			pos = False
			break
	if pos:
		print('YES')
	else:
		print('NO')
	t -= 1


from sys import stdin

def iinput():
	return int(stdin.readline())

def minput():
	return map(int, stdin.readline().split())

def linput():
	return list(map(int, stdin.readline().split()))
t = iinput()
while t:
	t -= 1
	n = iinput()
	a = linput()
	a.sort()
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			print('NO')
			break
	else:
		print('YES')


def something(s, r):
	r = sorted(r)
	for i in range(s - 1):
		j = i + 1
		if abs(r[i] - r[j]) > 1:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	r = int(input())
	s = list(map(int, input().split()))
	print(something(r, s))


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


count = int(input())
for c in range(count):
	size = int(input())
	data = [int(i) for i in input().split()]
	sortt = sorted(data)
	ans = 'YES'
	for i in range(size - 1):
		if sortt[i + 1] - sortt[i] > 1:
			if c == 333:
				ans = ','.join((str(e) for e in data))
			else:
				ans = 'NO'
			break
	print(ans)


from sys import stdin
nii = lambda : map(int, stdin.readline().split())
lnii = lambda : list(map(int, stdin.readline().split()))
t = int(input())
for i in range(t):
	n = int(input())
	a = lnii()
	a.sort()
	ans = True
	for j in range(1, n):
		if a[j] - a[j - 1] >= 2:
			ans = False
	if ans:
		print('YES')
	else:
		print('NO')


op = []
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	c = 0
	for i in range(1, n):
		if not (a[i - 1] == a[i] or a[i - 1] == a[i] - 1):
			op.append(False)
			break
	else:
		op.append(True)
for v in op:
	if v:
		print('YES')
	else:
		print('NO')


from collections import Counter

def solution(n, nums):
	if n == 1:
		return 'YES'
	for x in range(n - 1):
		result = nums[x + 1] - nums[x] <= 1
		if result == False:
			return 'NO'
	return 'YES'
tests = int(input())
for _ in range(tests):
	n = int(input().strip())
	nums = sorted(list(map(int, input().strip().split())))
	print(solution(n, nums))


t = int(input())
for ll in range(t):
	n = int(input())
	integers = set(map(int, input().split(' ')))
	integers = list(integers)
	integers.sort()
	for i in range(1, len(integers)):
		if abs(integers[i] - integers[i - 1]) > 1:
			print('NO')
			break
	else:
		print('YES')


from math import *
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	f = True
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			f = False
	if f:
		print('YES')
	else:
		print('NO')


t = int(input())

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


t = int(input())
for i in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	if n == 1:
		print('YES')
		continue
	l.sort()
	flag = True
	for i in range(n - 1):
		if abs(l[i + 1] - l[i]) > 1:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	li = [int(x) for x in input().split()]
	li.sort()
	for i in range(n - 1):
		if li[i + 1] - li[i] > 1:
			print('NO')
			break
	else:
		print('YES')


def read_int():
	return int(input())

def read_int_list():
	return list(map(int, input().split(' ')))
for _ in range(read_int()):
	_ = read_int()
	list_input = sorted(read_int_list(), reverse=False)
	index = 0
	answer = True
	while index < len(list_input) - 1:
		answer &= abs(list_input[index] - list_input[index + 1]) <= 1
		if not answer:
			break
		index += 1
	print('YES' if answer else 'NO')


t = int(input())
for i in range(t):
	m = int(input())
	numbers = list(sorted(set(map(int, input().split()))))
	len_numbers = len(numbers)
	if len_numbers == 1:
		print('YES')
	else:
		ok = False
		for j in range(1, len_numbers):
			if abs(numbers[j] - numbers[j - 1]) > 1:
				ok = False
				break
			else:
				ok = True
		if ok:
			print('YES')
		else:
			print('NO')


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


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


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


import sys
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, sys.stdin.readline().split()))
	arr.sort()
	flag = 0
	for i in range(1, n):
		if arr[i] - arr[i - 1] > 1:
			flag = 1
			print('NO')
			break
	if flag == 0:
		print('YES')


import sys

def solve(A):
	if len(A) == 1:
		return True
	else:
		A.sort()
		good = True
		for i in range(1, len(A)):
			if A[i - 1] < A[i] - 1:
				good = False
				break
		return good
IN = [x.strip() for x in sys.stdin.readlines()]
T = int(IN[0])
cur = 1
for ti in range(T):
	a = [int(x) for x in IN[cur + 1].split(' ')]
	print('YES' if solve(a) else 'NO')
	cur += 2


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = 1
	k = min(a)
	for i in sorted(a):
		if i - k > 1:
			s = 0
			break
		k = i
	if s:
		print('YES')
	else:
		print('NO')


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


t = int(input())
for cases in range(0, t):
	n = int(input())
	a = []
	a = list(map(int, input().strip().split()))[:n]
	a.sort()
	possible = True
	for i in range(len(a) - 1, 0, -1):
		if a[i] - a[i - 1] > 1:
			possible = False
			break
	if possible:
		print('YES')
	else:
		print('NO')


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


def remove_smallest(a, L):
	for i in range(L):
		try:
			if abs(a[i] - a[i + 1]) > 1:
				return 'NO'
		except IndexError:
			pass
	return 'YES'
n = int(input())
for i in range(n):
	leng = int(input())
	arr = list(map(int, input().rstrip().split()))
	print(remove_smallest(sorted(arr), leng))


t = int(input())
for x in range(t):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	arr.sort()
	check = True
	while len(arr) > 1:
		if arr[1] - arr[0] <= 1:
			arr.pop(0)
		else:
			check = False
			break
	if check:
		print('YES')
	else:
		print('NO')


test = int(input())
for j in range(test):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	flag = 0
	for i in range(1, n):
		if abs(l[i] - l[i - 1]) > 1:
			flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


T = int(input())
for _ in range(T):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	if any((abs(arr[i] - arr[i + 1]) > 1 for i in range(n - 1))):
		print('NO')
	else:
		print('YES')


def solve(arr):
	if len(arr) <= 1:
		return 'YES'
	arr.sort()
	for i in range(len(arr) - 1):
		if abs(arr[i + 1] - arr[i]) <= 1:
			continue
		else:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	print(solve(arr))


t = int(input())
while t > 0:
	t -= 1
	n = input()
	arr = list(map(int, input().strip().split(' ')))
	ans = True
	arr.sort()
	for i in range(len(arr) - 1):
		if abs(arr[i] - arr[i + 1]) > 1:
			ans = False
			break
	if len(arr) == 1 or ans:
		print('YES')
	else:
		print('NO')


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


t = int(input())
while t > 0:
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort()
	ans = 'YES'
	for i in range(n - 1):
		if arr[i + 1] - arr[i] <= 1:
			i += 1
		else:
			ans = 'NO'
			break
	print(ans)
	t -= 1


import math
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	ar = [int(c) for c in input().split()]
	c = 'YES'
	ar = sorted(ar)
	for i in range(1, n):
		if ar[i] - ar[i - 1] > 1:
			c = 'NO'
			break
	print(c)


t = int(input())
for i in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	lst.sort()
	list_len = len(lst)
	while list_len > 1:
		k = 1
		abs_diff = abs(lst[k] - lst[k - 1])
		if abs_diff > 1:
			break
		else:
			lst.pop(k - 1)
			list_len -= 1
	if list_len != 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().strip().split()))
	a = sorted(a)
	flag = True
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


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


from os import path
import sys
from heapq import heappush, heappop, heapify
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input().rstrip()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def b(i):
	return ord(i) - ord('a')
file = 1

def solve():
	for _ in range(ii()):
		n = ii()
		a = li()
		a.sort()
		f = 0
		for i in range(1, n):
			if a[i] - a[i - 1] > 1:
				f = 1
				break
		if f:
			print('NO')
		else:
			print('YES')
if file:
	if path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


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


from sys import stdout, stdin
from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	k = 'YES'
	for i in range(1, n):
		if abs(l[i] - l[i - 1]) > 1:
			k = 'NO'
			break
	print(k)


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
sys.setrecursionlimit(10 ** 6)
from queue import PriorityQueue
from collections import Counter as cc
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
import sys
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	if n == 1:
		print('YES')
		continue
	flag = 0
	for i in range(1, n):
		if l[i] - l[i - 1] > 1:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	x = int(input())
	a = set(map(int, input().split()))
	print('YES' if max(a) - min(a) < len(a) else 'NO')


def solve():
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	for i in range(n - 1):
		if l[i + 1] - l[i] > 1:
			print('NO')
			break
	else:
		print('YES')
for _ in range(int(input())):
	solve()


for _ in range(int(input())):
	input()
	data = sorted(map(int, input().split()))
	if len(data) == 1:
		print('YES')
	else:
		print(('YES', 'NO')[max((v2 - v1 for (v1, v2) in zip(data, data[1:]))) >= 2])


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(j) for j in input().split()[:n]]
	a.sort()
	a = list(set(a))
	b = a.copy()
	c = []
	if len(a) == 1:
		print('YES')
	else:
		k = 0
		while k < len(a) - 1:
			if abs(a[k] - a[k + 1]) <= 1:
				c.append(a[k])
			else:
				pass
			k += 1
		l = 0
		while len(c) != 0:
			b.remove(c[l])
			c.pop(l)
		if len(b) == 1:
			print('YES')
		else:
			print('NO')


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


def fun(l):
	for i in range(len(l) - 1):
		if abs(l[i] - l[i + 1]) <= 1:
			continue
		else:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	N = int(input())
	l = set(map(int, input().split()))
	l = list(l)
	l = sorted(l)
	print(fun(l))


t = int(input())
cnt = 0
for g in range(t):
	n = int(input())
	a = [int(n) for n in input().split()]
	a.sort()
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) <= 1:
			cnt += 1
		elif abs(a[i] - a[i + 1]) > 1:
			cnt += 0
	if cnt == n - 1:
		print('YES')
	else:
		print('NO')
	cnt = 0


for _ in range(int(input())):
	N = int(input())
	nums = list(map(int, input().split()))
	nums.sort()
	removed = [False] * N
	for i in range(N):
		for j in range(i + 1, N):
			if abs(nums[i] - nums[j]) <= 1:
				removed[i] = True
	if removed.count(True) == N - 1:
		print('YES')
	else:
		print('NO')


def makelist(n):
	b = []
	for i in range(n):
		b.append(0)
	return b

def countsort(ls):
	k = -99999999
	n = len(ls)
	for i in range(n):
		if ls[i] > k:
			k = ls[i]
	c = makelist(k + 1)
	b = makelist(n)
	for i in range(n):
		c[ls[i]] += 1
	for i in range(1, k + 1):
		c[i] += c[i - 1]
	for i in range(n - 1, -1, -1):
		b[c[ls[i]] - 1] = ls[i]
		c[ls[i]] -= 1
	return b
lst = []
t = int(input())
for z in range(t):
	lm = int(input())
	s = list(map(int, input().rstrip().split()))
	if lm == 1:
		lst.append('YES')
	else:
		s = countsort(s)
		active = True
		for i in range(lm - 1, 0, -1):
			if abs(s[i] - s[i - 1]) > 1:
				lst.append('NO')
				active = False
				break
		if active == True:
			lst.append('YES')
for i in lst:
	print(i)


def calc(n, a):
	if n > 1:
		tmp = min(a)
		a.remove(tmp)
		if (tmp in a) | (tmp + 1 in a):
			return calc(n - 1, a)
		else:
			return 'NO'
	else:
		return 'YES'

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		a = list(map(lambda x: int(x), input().split()))
		print(calc(n, a))
main()


t = int(input())
for i in range(t):
	list1 = []
	n = int(input())
	a = input().split()
	for z in a:
		list1.append(int(z))
	list1 = list(dict.fromkeys(list1))
	list1.sort()
	if len(list1) == 1:
		print('YES')
	else:
		while len(list1) > 1:
			if list1[1] - list1[0] == 1:
				list1.remove(list1[0])
			else:
				break
		if len(list1) == 1:
			print('YES')
		else:
			print('NO')


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


import math
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = list(set(a))
	s.sort()
	diff = []
	for i in range(len(s) - 1):
		diff.append(s[i + 1] - s[i])
	x = False
	for i in diff:
		if i > 1:
			x = True
	if x == True:
		print('NO')
	else:
		print('YES')


x = int(input())
for i in range(x):
	n = int(input())
	a = list(map(int, input().split()))
	s = min(a)
	b = max(a)
	ans = True
	for j in range(s, b + 1):
		if j not in a:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


testcases = int(input())
for testcase in range(testcases):
	n = int(input())
	temparr = input()
	temparr = temparr.split()
	arr = []
	for i in temparr:
		arr.append(int(i))
	arr = sorted(arr)
	if len(arr) == 1:
		print('YES')
	else:
		flag = 0
		for i in range(1, n):
			if arr[i] - arr[i - 1] > 1:
				flag = 1
				break
		if flag == 0:
			print('YES')
		else:
			print('NO')


for n in [*open(0)][2::2]:
	m = {*map(int, n.split())}
	print('YNEOS'[len(m) <= max(m) - min(m)::2])


def result(L):
	for i in range(1, len(L)):
		if abs(L[i] - L[i - 1]) > 1:
			return False
	return True
for _ in range(int(input())):
	n = int(input())
	L = [int(x) for x in input().split()]
	L.sort()
	if len(L) == 1:
		print('YES')
	elif result(L) == True:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	b = False
	n = int(input())
	a = sorted(list(map(int, input().split())))
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			b = True
			break
	if b is True:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	i = 0
	f = 0
	count = 0
	while i < n - 1:
		if abs(a[i] - a[i + 1]) <= 1:
			i += 1
			count += 1
		else:
			f = 1
			break
	if f == 1 and n - count > 1:
		print('NO')
	else:
		print('YES')


t = int(input())
lines = ''
ans = ''

def mergeSort(arr):
	if len(arr) > 1:
		mid = len(arr) // 2
		L = arr[:mid]
		R = arr[mid:]
		mergeSort(L)
		mergeSort(R)
		i = 0
		j = 0
		k = 0
		while i < len(L) and j < len(R):
			if L[i] < R[j]:
				arr[k] = L[i]
				i = i + 1
			else:
				arr[k] = R[j]
				j = j + 1
			k = k + 1
		while i < len(L):
			arr[k] = L[i]
			i = i + 1
			k = k + 1
		while j < len(R):
			arr[k] = R[j]
			j = j + 1
			k = k + 1
		return arr
	else:
		return arr

def convert(l):
	i = 0
	L = []
	for i in range(len(l)):
		L = L + [int(l[i])]
	return L

def f(x):
	y = x.split(' ')
	z = mergeSort(convert(y))
	i = 0
	for i in range(len(z) - 1):
		a = z[i]
		b = z[i + 1]
		if b - a > 1:
			return 'NO'
		else:
			i += 1
	return 'YES'
for i in range(2 * t):
	x = input()
	lines += x + '\n'
	if i % 2 != 0:
		ans += f(x) + '\n'
print(ans)


for _ in range(int(input())):
	d = input()
	a = sorted(list(set(map(int, input().split()))))
	b = len(a)
	if b == 1:
		print('YES')
	elif b == 0:
		print('NO')
	else:
		i = 0
		for x in a:
			v = x + 1
			if v in a:
				i += 1
		b = len(a)
		w = b - i
		if w == 1:
			print('YES')
		else:
			print('NO')


t = int(input())
for tt in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	i = 1
	while i < len(a):
		if a[i] - a[i - 1] > 1:
			i = i
		else:
			a[i - 1] = -1
			a.remove(a[i - 1])
			i = i - 1
		i = i + 1
	if len(a) > 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	input()
	s = sorted([int(x) for x in input().split()])
	f = 0
	for i in range(1, len(s)):
		if s[i - 1] != s[i] and s[i - 1] != s[i] - 1:
			print('NO')
			f = 1
			break
	if f == 0:
		print('YES')


for i in range(int(input())):
	n = int(input())
	arrr = list(map(int, input().split()))
	origlen = len(arrr)
	s = set(arrr)
	arr = list(s)
	arr.sort()
	i = 0
	ans = []
	while i < len(arr) - 1:
		if abs(arr[i] - arr[i + 1]) <= 1:
			arr.pop(i)
		else:
			i += 1
	if len(arr) == 1:
		print('YES')
	elif len(arr) == 0:
		if origlen % 2 == 0 or origlen == 1:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	t = int(input())
	l = list(map(int, input().split()))
	l.sort()
	f = 0
	p1 = 0
	p2 = 1
	while p2 < len(l):
		if l[p2] - l[p1] > 1:
			f = 1
			break
		else:
			p2 += 1
			p1 += 1
	if f == 1:
		print('NO')
	else:
		print('YES')


ans = []
for _ in range(int(input())):
	n = int(input())
	a = sorted((int(x) for x in input().split()))
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			ans.append('NO')
			break
	else:
		ans.append('YES')
print('\n'.join(ans))


t = int(input())
for i in range(t):
	a = int(input())
	a1 = list(map(int, input().split(' ')))
	a1.sort()
	if len(a1) == 1 or len(a1) == 0:
		print('YES')
	else:
		s = ''
		n = 0
		while n < len(a1) - 1:
			if a1[n + 1] - a1[n] == 1:
				s = 'YES'
			elif a1[n + 1] - a1[n] == 0:
				s = 'YES'
			else:
				s = 'NO'
				break
			n = n + 1
		print(s)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	f = False
	for i in range(n - 1):
		if abs(l[i] - l[i + 1]) > 1:
			f = True
			print('NO')
			break
	if f == False:
		print('YES')


T = int(input())
while T != 0:
	N = int(input())
	a = list(map(int, input().strip().split()))[:N]
	a.sort()
	found = True
	for i in range(N - 1):
		if a[i + 1] - a[i] > 1:
			found = False
	if found:
		print('YES')
	else:
		print('NO')
	T -= 1


t = int(input())
for _ in range(t):
	m = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 'YES'
	for i in range(len(a) - 1):
		if a[i + 1] - a[i] > 1:
			ans = 'NO'
			break
	print(ans)


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


for tt in range(int(input())):
	n = int(input())
	a = [int(_) for _ in input().split()]
	a.sort()
	ok = True
	for i in range(1, n):
		ok &= a[i] - a[i - 1] <= 1
	print('YES' if ok else 'NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	left = 1
	for i in range(1, n):
		if abs(a[i] - a[i - 1]) <= 1:
			continue
		left += 1
	if left == 1:
		print('YES')
	else:
		print('NO')


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	N = int(sys.stdin.readline())
	list_num = list(map(int, sys.stdin.readline().split()))
	list_num.sort()
	can = 1
	for i in range(N - 1):
		if list_num[i + 1] - list_num[i] > 1:
			can = 0
			break
	print('YES' if can else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	numbers = [int(x) for x in input().split()]
	numbers = sorted(numbers)
	valid = True
	for j in range(1, n):
		if numbers[j] - numbers[j - 1] > 1:
			valid = False
			break
	if valid:
		print('YES')
	else:
		print('NO')


t = int(input())
for x in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split(' '))))
	while len(a) > 1:
		if abs(a[0] - a[1]) <= 1:
			if a[0] < a[1]:
				a.pop(0)
			else:
				a.pop(1)
		else:
			break
	if len(a) == 1:
		print('YES')
	else:
		print('NO')


from sys import stdin
_input = stdin.readline
(_max, _str, _min, _int, _range) = (max, str, min, int, range)

def solution():
	for _ in _range(_int(_input())):
		n = _int(_input())
		arr = {_int(i) for i in _input().rstrip('\n').split()}
		for i in _range(_min(arr), _max(arr)):
			if i not in arr:
				print('NO')
				break
		else:
			print('YES')
solution()


t = int(input())
while t > 0:
	n = int(input())
	arr = input().split(' ')
	arr = [int(i) for i in arr]
	arr.sort()
	while len(arr) > 1:
		if abs(arr[0] - arr[1]) <= 1:
			arr.pop(0)
		else:
			print('NO')
			break
	if len(arr) <= 1:
		print('YES')
	t -= 1


from sys import stdin

def main():
	res = stdin.read().splitlines()[2::2]
	for (i, s) in enumerate(res):
		l = sorted(map(int, s.split()))
		res[i] = ('NO', 'YES')[max((b - a for (a, b) in zip(l, l[1:])), default=0) < 2]
	print('\n'.join(res))
main()


t = int(input())
while t > 0:
	n = int(input())
	lis = [int(a) for a in input().split()]
	lis.sort()
	isNot = True
	for i in range(len(lis) - 1):
		x = lis[i] - lis[i + 1]
		if x < -1 or x > 1:
			isNot = False
			break
	if isNot:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	i = 0
	j = len(a) - 1
	b = True
	while i < j:
		if a[i] + 1 < a[i + 1]:
			b = False
			break
		if a[j] - 1 > a[j - 1]:
			b = False
			break
		i += 1
		j -= 1
	if b:
		print('YES')
	else:
		print('NO')


YES = 'YES'
NO = 'NO'

def solve(N, A):
	A.sort()
	prev = A[0]
	for i in range(1, N):
		curr = A[i]
		if abs(curr - prev) >= 2:
			return False
		prev = curr
	return True

def main():
	T = int(input())
	for _ in range(T):
		N = int(input())
		A = list(map(int, input().split()))
		ans = solve(N, A)
		print(YES if ans else NO)
main()


t = int(input())
for k in range(t):
	n = int(input())
	l = input().split()
	a = []
	for e in l:
		a.append(int(e))
	a.sort()
	n = len(a)
	flag = True
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) > 1:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


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


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict, Counter
import math

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

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()
t = intIn()
while t > 0:
	t -= 1
	n = intIn()
	a = listIn()
	a.sort()
	ans = 0
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			ans = 1
			break
	if ans == 1:
		print('NO')
	else:
		print('YES')


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


import sys
import os
from collections import Counter, deque, defaultdict
import itertools
import math
import io

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))

def mi():
	return map(int, input().split())

def main():
	for i in range(ii()):
		n = ii()
		a = li()
		x = sorted(a)
		s = 'YES'
		for i in range(1, n):
			if abs(x[i] - x[i - 1]) > 1:
				s = 'NO'
				break
		print(s)
main()


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = input()
	a = list(sorted(map(int, stdin.readline().split())))
	f = 0
	prv = a[0]
	for i in a:
		if abs(prv - i) > 1:
			f = 1
		prv = i
	if f == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	a = [int(j) for j in input().split()]
	a.sort()
	flag = True
	for i in range(0, len(a) - 1):
		if a[i + 1] - a[i] > 1:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


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


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	d = set(a)
	b = sorted(d)
	for i in b:
		if i + 1 in d and i in b:
			d.remove(i)
	print('YES' if len(d) == 1 else 'NO')


def solve(arr):
	arr = sorted(arr)
	diffs = [True if abs(arr[i] - arr[i + 1]) in (0, 1) else False for i in range(len(arr) - 1)]
	if all(diffs) or len(arr) == 1:
		return 'YES'
	else:
		return 'NO'
t = int(input())
for _ in range(t):
	n = int(input())
	arr = map(int, input().split())
	print(solve(arr))


def solve():
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	for i in range(n - 1):
		if abs(A[i] - A[i + 1]) > 1:
			return 'NO'
	return 'YES'
t = int(input())
for l in range(t):
	print(solve())


for _ in range(int(input())):
	n = input()
	arr = sorted(list(set(map(int, input().split()))))
	flag = True
	for i in range(len(arr)):
		if i != len(arr) - 1 and arr[i + 1] - arr[i] != 1:
			flag = False
	print('YES' if flag else 'NO')


x = int(input())
for i in range(x):
	input()
	v = sorted([int(x) for x in input().split()])
	n = 'YES'
	for i in range(len(v) - 1):
		if abs(v[i] - v[i + 1]) > 1:
			n = 'NO'
	print(n)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	k = 0
	a.sort()
	for i in range(0, len(a) - 1):
		if abs(a[i + 1] - a[i]) <= 1:
			a[i] = -1
	for i in range(0, len(a)):
		if a[i] > 0:
			k += 1
	if k > 1:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()][:n]
	a.sort()
	for j in range(n - 1):
		if a[j + 1] - a[j] <= 1:
			continue
		else:
			print('NO')
			break
	else:
		print('YES')


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


from collections import defaultdict

def FindSubArraySum(l, n, sum1):
	res = 0
	curr = 0
	m = defaultdict(lambda : 0)
	for i in range(0, n):
		curr += l[i]
		if curr == sum1:
			res += 1
		if curr - sum1 in m:
			res += m[curr - sum1]
		m[curr] += 1
	return res
for cases in range(int(input())):
	s = 'YES'
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	for i in range(1, n):
		if l[i] - l[i - 1] > 1:
			s = 'NO'
			break
	print(s)


import sys

def solve(n, nums):
	nums.sort()
	for i in range(1, n):
		if nums[i] - nums[i - 1] > 1:
			return 'NO'
	return 'YES'
t = int(input())
while t:
	n = int(input())
	nums = list(map(int, input().split()))
	print(solve(n, nums))
	t -= 1


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


import math
t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split(' ')))
	a.sort()
	i = 0
	while True:
		if i >= len(a) - 1:
			break
		if int(math.fabs(a[i] - a[i + 1])) <= 1:
			del a[i]
			i = 0
		else:
			i += 1
	if len(a) == 1:
		print('YES')
	else:
		print('NO')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	fl = 0
	p2 = 0
	p1 = 1
	while p1 < n:
		if abs(ar[p1] - ar[p2]) <= 1:
			p1 += 1
			p2 += 1
			fl = 0
		else:
			fl = 1
			break
	if fl == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(j) for j in input().split()]
	arr.sort()
	flag = 0
	for i in range(n - 1):
		if arr[i + 1] - arr[i] > 1:
			flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


import sys
input = sys.stdin.readline
for nt in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	flag = 'YES'
	for i in range(1, n):
		if a[i] - a[i - 1] >= 2:
			flag = 'NO'
			break
	print(flag)


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


def removeSmallest(arr):
	if len(arr) == 1:
		return 'YES'
	i = 0
	j = 1
	k = 1
	arr.sort()
	while j < len(arr):
		if abs(arr[i] - arr[j]) <= 1:
			arr.pop(i)
			if len(arr) == 1:
				return 'YES'
			i = 0
			j = 0
		if j >= len(arr):
			i = k
			j = k
			k += 1
		j += 1
	return 'NO'
n = int(input())
outputs = []
for i in range(n):
	l = int(input())
	arr = [None] * l
	s = input() + ' '
	for j in range(l):
		a = s.find(' ')
		arr[j] = int(s[0:a])
		s = s[a + 1:len(s)]
	outputs.append(removeSmallest(arr))
for x in outputs:
	print(x)


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


tc = int(input())
while tc > 0:
	tc -= 1
	n = int(input())
	arr = []
	arr = list(map(int, input().strip().split()))[:n]
	arr.sort()
	flag = True
	for i in range(0, n - 1):
		if abs(arr[i] - arr[i + 1]) > 1:
			flag = False
			break
	if flag == True:
		print('YES')
	else:
		print('NO')


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


for _ in range(int(input())):
	import copy
	n = int(input())
	no = list(map(int, input().split()))
	y = no.copy()
	no.sort()
	y.sort()
	for i in range(n - 1):
		if abs(no[i] - no[i + 1]) == 1 or no[i] - no[i + 1] == 0:
			y.pop()
	if len(y) == 1:
		print('YES')
	else:
		print('NO')


test = int(input())
while test > 0:
	test -= 1
	size = int(input())
	arr = list(map(int, input().split()))
	sep = 0
	arr.sort()
	for i in range(size - 1):
		if arr[i] == arr[i + 1] or arr[i + 1] - arr[i] == 1:
			continue
		sep += 1
	if sep == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
length = []
nums = []
for i in range(t):
	length.append(int(input()))
	nums.append(list(map(int, input().split())))

def solve(n, arr):
	if len(set(arr)) == 1:
		return 'YES'
	arr.sort()
	for i in range(1, len(arr)):
		if arr[i] - arr[i - 1] > 1:
			return 'NO'
	return 'YES'
for i in range(t):
	print(solve(length[i], nums[i]))


t = int(input())
while t > 0:
	n = int(input())
	temp = list(map(int, input().split()))
	temp.sort()
	t1 = []
	for i in range(len(temp) - 1):
		if abs(temp[i] - temp[i + 1]) <= 1:
			t1.append(temp[i])
	for i in t1:
		if i in temp:
			temp.remove(i)
	if len(temp) == 1:
		print('YES')
	else:
		print('NO')
	t = t - 1


from sys import stdin, stdout
tt = int(stdin.readline().strip())
for _ in range(tt):
	n = int(stdin.readline().strip())
	arr = list(map(int, stdin.readline().strip().split()))
	arr.sort()
	check = True
	for i in range(1, n):
		if arr[i] - arr[i - 1] > 1:
			check = False
			break
	if check:
		print('YES')
	else:
		print('NO')


def process(l):
	l.sort()
	for i in range(0, len(l) - 1):
		if abs(l[i] - l[i + 1]) > 1:
			print('NO')
			return
		else:
			continue
	print('YES')

def main():
	n = int(input())
	for i in range(n):
		g = int(input())
		p = [int(x) for x in input().split()]
		process(p)
main()


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().rstrip().split()))
	b = a.sort()
	g = True
	for k in range(n - 1):
		if a[k + 1] - a[k] > 1:
			g = False
			break
	if g:
		print('YES')
	else:
		print('NO')


test = int(input())
for i in range(test):
	size = int(input())
	number = [int(i) for i in input().split()]
	number.sort()
	result = True
	for i in range(0, size - 1):
		result = result and number[i + 1] - number[i] <= 1
	print('YES') if result == True else print('NO')


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
n = inp()
for _ in range(n):
	l = inp()
	a = inlt()
	ans = 'YES'
	a = sorted(a)
	for _ in range(1, len(a)):
		if a[_] - a[_ - 1] > 1:
			ans = 'NO'
			break
	print(ans)


t = int(input())
c = []
for j in range(t):
	n = int(input())
	a = [int(u) for u in input().split()]
	a.sort()
	p = 0
	for i in range(n - 1):
		if a[i + 1] != a[i] and a[i + 1] != a[i] + 1:
			p = 1
			break
	if p == 1:
		c.append('NO')
	else:
		c.append('YES')
for k in c:
	print(k)


n = int(input())
a = []
for i in range(n):
	a.append([])
	j = int(input())
	a[i] = (0 for k in range(j))
	a[i] = list(map(int, input().split()))
for i in range(n):
	b = set(a[i])
	c = list(b)
	M = max(a[i])
	m = min(a[i])
	if len(a[i]) != 1:
		if (M - m) / len(c) >= 1:
			print('NO')
		else:
			print('YES')
	elif len(a[i]) == 1:
		print('YES')


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


import sys
import math

def II():
	return int(sys.stdin.readline())

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

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

def SI():
	return sys.stdin.readline().strip()
t = II()
for q in range(t):
	n = II()
	a = sorted(LI())
	boo = True
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			boo = False
			break
	print('YES' if boo else 'NO')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	f = 1
	if len(a) == 1:
		print('YES')
	else:
		for i in range(len(a) - 1):
			if a[i + 1] - a[i] > 1:
				f = 0
				break
		print('YES' if f else 'NO')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	if n == 1:
		print('YES')
		continue
	for i in range(n - 1):
		if a[i] + 1 < a[i + 1]:
			print('NO')
			break
	else:
		print('YES')


def sort_puz(mas):
	for i in range(len(mas) - 1):
		for j in range(i + 1, len(mas)):
			if mas[i] > mas[j]:
				(mas[i], mas[j]) = (mas[j], mas[i])
	return mas
n = int(input())
i = 0
while i < n:
	a = int(input())
	mas = [int(j) for j in input().split()]
	mas = sort_puz(mas)
	j = 0
	while j < len(mas) - 1:
		if abs(mas[j] - mas[j + 1]) <= 1:
			mas.pop(j)
		else:
			j += 1
	if len(mas) == 1:
		print('YES')
	else:
		print('NO')
	i += 1


t = int(input())
p = []
q = []
for i in range(t):
	u = int(input())
	o = list(map(int, input().split()))
	p.append(u)
	q.append(o)

def tully(p, q):
	q.sort()
	flag = 1
	for i in range(p - 1):
		if q[i + 1] - q[i] > 1:
			flag = 0
			break
	if flag:
		print('YES')
	else:
		print('NO')
for i in range(t):
	tully(p[i], q[i])


import sys

def merge(arr1, arr2):
	(i, j) = (0, 0)
	arr = []
	for k in range(len(arr1) + len(arr2)):
		if i >= len(arr1):
			arr.append(arr2[j])
			j += 1
		elif j >= len(arr2):
			arr.append(arr1[i])
			i += 1
		elif arr1[i] < arr2[j]:
			arr.append(arr1[i])
			i += 1
		else:
			arr.append(arr2[j])
			j += 1
	return arr

def MergeSort(numbers):
	if len(numbers) <= 1:
		return numbers
	mid = len(numbers) // 2
	left_part = MergeSort(numbers[:mid])
	right_part = MergeSort(numbers[mid:])
	return merge(left_part, right_part)

def answer(a):
	a = MergeSort(a)
	Run = True
	len1 = len(a)
	if len(a) > 1:
		while Run:
			if a[1] - a[0] <= 1:
				a.pop(0)
			if len1 == len(a) or len(a) == 1:
				Run = False
			else:
				len1 = len(a)
	if len(a) == 1:
		sys.stdout.write('YES\n')
	else:
		sys.stdout.write('NO\n')
t = int(sys.stdin.readline().split()[0])
for i in range(t):
	n = int(sys.stdin.readline().split()[0])
	numbers = sys.stdin.readline().split()
	for j in range(n):
		numbers[j] = int(numbers[j])
	answer(numbers)


for i in range(int(input())):
	a = int(input())
	b = [int(i) for i in input().split()]
	b = list(set(b))
	b.sort()
	if len(b) == 1:
		print('YES')
	else:
		flag = True
		for i in range(len(b) - 1):
			if b[i] + 1 != b[i + 1]:
				flag = False
		if flag == True:
			print('YES')
		else:
			print('NO')


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


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	f = 0
	for i in range(1, n):
		if abs(a[i] - a[i - 1]) > 1:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	tam = int(input())
	numeros = list(map(int, input().split()))
	numeros.sort()
	sePuede = True
	for i in range(len(numeros) - 1):
		if abs(numeros[i] - numeros[i + 1]) > 1:
			sePuede = False
			break
	if sePuede:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	mn = min(a)
	mx = max(a)
	ans = 'YES'
	for i in range(mn, mx + 1):
		if i not in a:
			ans = 'NO'
			break
	print(ans)


mod = 10 ** 9 + 7

def solve():
	d = {}
	n = int(input())
	a = list(map(int, input().split()))
	vec = []
	for x in a:
		if x not in vec:
			vec.append(x)
	print('YES' if max(vec) - min(vec) + 1 == len(vec) else 'NO')
t = 1
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(set(a))
	b.sort()
	f = 0
	if len(b) == 1 or len(b) == 0:
		print('YES')
	else:
		i = 0
		while i < len(b) - 1:
			if abs(b[i] - b[i + 1]) <= 1:
				b.pop(i)
				i = 0
			else:
				i += 1
		if len(b) == 1:
			print('YES')
		else:
			print('NO')


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


for y in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	lst.sort()
	flag = 0
	for i in range(1, n):
		if lst[i] - lst[i - 1] == 0 or lst[i] - lst[i - 1] == 1:
			pass
		else:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	if len(a) == 1:
		print('YES')
	else:
		j = 1
		l = len(a)
		while l != 1:
			if abs(a[j - 1] - a[j]) <= 1:
				if a[j - 1] < a[j]:
					a.remove(a[j - 1])
				else:
					a.remove(a[j])
			else:
				print('NO')
				break
			l = len(a)
		if len(a) == 1:
			print('YES')


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


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


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


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


ans = []
n = int(input())
for i in range(n):
	k = int(input())
	x = input().split(' ')
	for j in range(k):
		x[j] = int(x[j])
	x = sorted(x)
	j = 0
	while j < len(x) - 1:
		if abs(x[j] - x[j + 1]) <= 1:
			x.pop(j)
			j -= 1
		j += 1
	if len(x) == 1:
		ans.append('YES')
	else:
		ans.append('NO')
for i in ans:
	print(i)


for w in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = True
	for e in range(1, n):
		if a[e] - a[e - 1] > 1:
			ans = False
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	arr = [int(j) for j in input().split(' ')]
	arr.sort()
	valid = True
	for j in range(n - 1):
		if abs(arr[j + 1] - arr[j]) > 1:
			valid = False
			break
	if valid:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	(n, a) = (int(input()), sorted(map(int, input().split())))
	print('YES' if all((a[i] - a[i - 1] <= 1 for i in range(1, n))) else 'NO')


no = int(input())
while no > 0:
	n = int(input())
	arr = list(map(int, input().strip().split(' ')))
	arr.sort()
	i = 0
	while i < len(arr) - 1:
		if abs(arr[i] - arr[i + 1]) <= 1:
			arr.pop(i)
		else:
			print('NO')
			break
	if len(arr) == 1:
		print('YES')
	no -= 1


def sovle(arr):
	arr.sort()
	n = len(arr)
	for i in range(n - 1):
		if arr[i + 1] - arr[i] > 1:
			return 'NO'
	return 'YES'
t = int(input())
while t:
	n = input()
	arr = list(map(int, input().split()))
	print(sovle(arr))
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	numbers = [int(x) for x in input().split()]
	numbers.sort()
	isGood = True
	for i in range(n - 1):
		if abs(numbers[i] - numbers[i + 1]) > 1:
			isGood = False
			break
	if isGood:
		print('YES')
	else:
		print('NO')


def dif1(a, n):
	if n == 1:
		return True
	else:
		a.sort()
		i = 1
		ok = abs(a[0] - a[1]) <= 1
		while ok and i < n - 1:
			ok = abs(a[i] - a[i + 1]) <= 1
			i += 1
		return ok
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if dif1(a, n):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	li = list(map(int, input().split()))
	li.sort()
	valid = True
	for i in range(1, n):
		if li[i] - li[i - 1] >= 2:
			valid = False
			break
	if valid:
		print('YES')
	else:
		print('NO')


def modinv(n, p):
	return pow(n, p - 2, p)

def main():
	for case in range(int(input())):
		n = int(input())
		a = [int(x) for x in input().split()]
		a.sort()
		ans = 'YES'
		for i in range(1, n):
			if a[i] - a[i - 1] > 1:
				ans = 'NO'
				break
		print(ans)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def check(l: list) -> str:
	l.sort()
	x = True
	for i in range(1, len(l)):
		x = x and l[i] - l[i - 1] <= 1
	if x:
		return 'YES'
	return 'NO'
t = int(input())
while t > 0:
	n = int(input())
	x = [int(x) for x in input().split()]
	print(check(x))
	t -= 1


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = set(l)
	m = min(s)
	c = 0
	for j in range(1, len(s)):
		if m + j in s:
			c += 1
	if c == len(s) - 1:
		print('YES')
	else:
		print('NO')


import sys
for bruh in range(0, int(sys.stdin.readline())):
	leng = int(sys.stdin.readline())
	mlist = list(map(int, sys.stdin.readline().split()))
	k = min(mlist)
	l = max(mlist)
	works = 'YES\n'
	while k < l + 1:
		if not k in mlist:
			works = 'NO\n'
		k += 1
	sys.stdout.write(works)


t = int(input())
for i in range(t):
	n = int(input())
	l = []
	l = [int(x) for x in input().split()]
	if n == 1:
		print('YES')
		continue
	l.sort()
	fg = 0
	for k in range(n - 1):
		if l[k + 1] - l[k] >= 2:
			fg = 1
			break
	if fg == 1:
		print('NO')
	else:
		print('YES')


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


def contain(L, a):
	for val in L:
		if val == a:
			return True
	return False

def find_max(L):
	temp = 0
	temp_idx = 0
	for (idx, val) in enumerate(L):
		if val > temp:
			temp = val
			temp_idx = idx
	return (temp_idx, temp)

def find(L, a):
	for (idx, val) in enumerate(L):
		if val == a:
			return (idx, val)
	return (-1, -1)
tests = int(input())
for t in range(tests):
	length = int(input())
	raw = input()
	A = list(map(int, raw.split()))
	(idx, temp) = find_max(A)
	A[idx] = -1
	breaked = False
	for i in range(length - 1):
		(idf, found) = find(A, temp)
		if idf != -1:
			A[idf] = -1
			temp = found
		else:
			(idf, found) = find(A, temp - 1)
			if idf != -1:
				A[idf] = -1
				temp = found
			else:
				print('NO')
				breaked = True
				break
	if not breaked:
		print('YES')


T = int(input())
for case in range(T):
	N = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort()
	impossible = False
	for i in range(len(arr) - 1):
		if abs(arr[i] - arr[i + 1]) <= 1:
			continue
		else:
			impossible = True
			break
	if impossible:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	arr = []
	elements = input().split(' ')
	for i in elements:
		arr.append(int(i))
	arr.sort()
	max_diff = -1
	for i in range(1, n):
		max_diff = max(max_diff, abs(arr[i] - arr[i - 1]))
	if n == 1:
		print('YES')
	elif max_diff > 1:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	x = sorted(set([int(k) for k in input().split()]))
	z = min(x)
	a = 'YES'
	for j in x:
		if abs(j - z) <= 1:
			z = j
		else:
			a = 'NO'
			break
	print(a)


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


def array(arr, struc):
	return list(map(struc, arr.split()))
n = int(input())
for i in range(n):
	lena = int(input())
	arr = array(input(), int)
	counter = 0
	arr.sort()
	for j in range(lena - 1):
		if abs(arr[j] - arr[j + 1]) > 1:
			counter = 1
	if counter == 0:
		print('YES')
	else:
		print('NO')


try:
	t = int(input())
	for i1 in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		x = 0
		for i in range(n - 1):
			if a[i + 1] <= a[i] + 1:
				x = 0
			else:
				x = 1
				break
		if x == 0:
			print('YES')
		else:
			print('NO')
except:
	pass


t = int(input())
for i in range(t):
	n = int(input())
	lst = [int(i) for i in input().split()]
	lst.sort()
	valid = True
	for i in range(len(lst) - 1):
		if lst[i + 1] - lst[i] > 1:
			valid = False
	if valid:
		print('YES')
	else:
		print('NO')


t = int(input())
results = []
for i in range(t):
	n = int(input())
	a = input().split()
	a = [int(i) for i in a]
	a.sort()
	while a:
		if len(a) == 1:
			results.append('YES')
			break
		mine = a[0]
		nextn = a[1]
		if nextn - mine <= 1:
			if mine < nextn:
				a.pop(0)
			else:
				a.pop(1)
		else:
			results.append('NO')
			break
for every in results:
	print(every)


n = int(input())
while n > 0:
	t = int(input())
	flag = 0
	arr = input().split(' ')
	arr2 = list(map(int, arr))
	arr2.sort()
	for i in range(1, len(arr2)):
		if abs(arr2[i] - arr2[i - 1]) > 1:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')
	n -= 1


from sys import stdin

def readline():
	return stdin.readline()
tests = int(readline())

def solve(n, a):
	a.sort()
	ans = 'YES'
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			ans = 'NO'
			break
	return ans
for t in range(0, tests):
	n = int(readline().rstrip('\n'))
	a = list(map(int, readline().rstrip('\n').split(' ')))
	print(solve(n, a))


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


for _ in range(int(input())):
	n = int(input())
	l = sorted(set([int(x) for x in input().split()]))
	if len(l) == l[-1] - l[0] + 1:
		print('YES')
	else:
		print('NO')


def remove_smallest(arr):
	idx_set = set()
	for (idx, val) in enumerate(arr):
		if val in idx_set:
			arr[idx] = -1
		else:
			idx_set.add(val)
	if len(idx_set) == 1:
		return True
	n_elems = 0
	for i in range(len(arr)):
		if arr[i] == -1:
			continue
		if arr[i] + 1 in idx_set:
			idx_set.remove(arr[i] + 1)
		else:
			n_elems += 1
		if n_elems > 1:
			return False
	return n_elems <= 1
for i in range(int(input())):
	input()
	res = remove_smallest([int(e) for e in input().split()])
	print('YES' if res else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	j = 0
	k = 1
	while j < n:
		while k < n:
			if abs(a[j] - a[k]) <= 1:
				if a[j] == min(a[j], a[k]):
					del a[j]
				else:
					del a[k]
				n -= 1
			else:
				k += 1
		j += 1
	if len(a) == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	temp = arr.copy()
	for i in range(0, n - 1):
		if abs(arr[i] - arr[i + 1]) <= 1:
			temp.remove(arr[i])
	if len(temp) == 1:
		print('YES')
	else:
		print('NO')


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


def diff1(arr, n):
	if n == 1:
		return 'YES'
	temp = abs(arr[0] - arr[1])
	templst = arr[:]
	for i in range(n - 1):
		diff = arr[i + 1] - arr[i]
		if diff > 1:
			return 'NO'
		else:
			x = templst.pop(0)
	if len(templst) == 1:
		return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	print(diff1(arr, n))


def num():
	return int(input())

def line():
	return map(int, input().split())
from itertools import repeat
t = num()
for _ in repeat(None, t):
	n = num()
	ass = sorted(set(line()))
	if len(ass) < 2:
		print('YES')
		continue
	for i in range(1, len(ass)):
		if ass[i - 1] + 1 != ass[i]:
			break
	else:
		print('YES')
		continue
	print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	p1 = 0
	p2 = 1
	r = 1
	for i in range(n - 1):
		if l[p2] - l[p1] <= 1:
			l.remove(l[p1])
			r += 1
			p1 = 0
			p2 = 1
		else:
			p1 += 1
			p2 += 1
	if len(l) == 1:
		print('YES')
	else:
		print('NO')


for s in [*open(0)][2::2]:
	a = {*map(int, s.split())}
	print(['YES', 'NO'][len(a) <= max(a) - min(a)])


cases = int(input(''))
list = []
outputlist = []
for case in range(cases):
	arraysize = int(input(''))
	integers = input('').split()
	if arraysize == 1:
		outputlist.append('YES')
	for integer in range(arraysize):
		list.append(int(integers[integer]))
	list.sort()
	for integer in range(arraysize - 1):
		if abs(list[integer] - list[integer + 1]) <= 1:
			if integer == arraysize - 2:
				outputlist.append('YES')
				list = []
		else:
			outputlist.append('NO')
			list = []
			break
print(*outputlist, sep='\n')


import sys
from math import sqrt
from collections import defaultdict
inpt = sys.stdin.readline

def inp():
	return int(inpt())

def inlist():
	return list(map(int, inpt().split()))

def instr():
	s = inpt()
	return list(s[:len(s) - 1])

def invr():
	return map(int, inpt().split())

class Graph:

	def __init__(self, n):
		self.n = n
		self.graph = defaultdict(list)
		self.marked = defaultdict(int)

	def addEdge(self, u, v):
		self.graph[u].append(v)
		self.graph[v].append(u)

	def dfs(self, u):
		self.marked[u] = 1
		for i in self.graph[u]:
			if self.marked[i] == 0:
				self.dfs(i)

def main():
	t = inp()
	for f in range(t):
		n = inp()
		a = inlist()
		a = sorted(a)
		t = True
		for i in range(1, n, 1):
			if a[i] - a[i - 1] > 1:
				t = False
				break
		if t:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for i in range(t):
	n = int(input())
	a = sorted(map(int, input().split()))
	p = a[0]
	for x in a:
		if x - p > 1:
			print('NO')
			break
		p = x
	else:
		print('YES')


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


import math
t = int(input())

def good(a):
	for x in range(1, len(a)):
		a = sorted(a)
		if abs(a[x] - a[x - 1]) <= 1:
			pass
		else:
			return False
	return True
while t > 0:
	n = int(input())
	arr = [int(x) for x in input().split()]
	print('YES' if good(arr) else 'NO')
	t -= 1


from sys import stdin, stdout
import heapq
import cProfile
from collections import Counter, defaultdict, deque
from functools import reduce
import math

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))

def solve():
	n = get_int()
	ls = get_list()
	ls.sort()
	for (i, v) in enumerate(ls[1:], 1):
		if abs(v - ls[i - 1]) > 1:
			return 'NO'
	return 'YES'

def main():
	print(solve())
TestCases = True
if TestCases:
	for i in range(get_int()):
		main()
else:
	main()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	flag = True
	for i in range(1, n):
		if l[i] - l[i - 1] > 1:
			flag = False
			break
	if flag or n == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	l = []
	n = int(input())
	a = list(map(int, input().rstrip().rsplit()))
	a.sort()
	d = {a[i]: a[i + 1] - a[i] for i in range(n - 1)}
	l = [i <= 1 for i in d.values()]
	if all(l):
		print('YES')
	else:
		print('NO')


t = int(input())
for k in range(t):
	n = int(input())
	liste = list(input().split())
	sliste = sorted(liste)
	tal = [int(s) for s in sliste]
	mtal = set(tal)
	if max(mtal) - min(mtal) < len(mtal):
		print('YES')
	else:
		print('NO')


import sys

def remove_smallest(arr):
	min_element = None
	max_element = None
	hset = set()
	tot_sum = 0
	for x in arr:
		if min_element is None:
			min_element = x
		else:
			min_element = min(min_element, x)
		if max_element is None:
			max_element = x
		else:
			max_element = max(max_element, x)
		if x not in hset:
			hset.add(x)
			tot_sum += x
	tot_uniq_n_sum = (max_element * (max_element + 1) - (min_element - 1) * min_element) / 2
	if tot_sum == tot_uniq_n_sum:
		return 'YES'
	else:
		return 'NO'
t = int(sys.stdin.readline().rstrip())
sol = []
for i in range(t):
	n = int(sys.stdin.readline().rstrip())
	arr = [int(x) for x in sys.stdin.readline().rstrip().split(' ')]
	sol.append(remove_smallest(arr))
for s in sol:
	print(s)


final = []
for i in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	flag = 0
	for j in range(len(l) - 1):
		if l[j + 1] - l[j] >= 2:
			final.append('NO')
			break
		else:
			flag += 1
	if flag == len(l) - 1:
		final.append('YES')
for i in range(len(final)):
	print(final[i])


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	ok = False
	a.sort()
	for i in range(1, n):
		if abs(a[i] - a[i - 1]) > 1:
			print('NO')
			ok = True
			break
	if not ok:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	arr = [*map(int, input().split())]
	res = False
	if n == 1:
		print('YES')
		continue
	arr = list(set(arr))
	arr.sort()
	for i in range(len(arr) - 1):
		if arr[i + 1] - arr[i] > 1:
			print('NO')
			res = True
			break
	if res == False:
		print('YES')


n = int(input())
for _ in range(n):
	res = 'YES'
	length = int(input())
	seq = [int(i) for i in input().split(' ')]
	seq.sort()
	for j in range(length - 1):
		if seq[1] - seq[0] <= 1:
			seq.pop(0)
	if len(seq) > 1:
		res = 'NO'
	print(res)


T = int(input())
while T:
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	F = 'YES'
	for i in range(n - 1):
		if abs(A[i + 1] - A[i]) > 1:
			F = 'NO'
	print(F)
	T = T - 1


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
while t > 0:
	n = inp()
	a = inlt()
	a.sort()
	flag = 'YES'
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			flag = 'NO'
			break
	print(flag)
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr = sorted(arr)
	flag = False
	for i in range(1, n):
		if arr[i] - arr[i - 1] >= 2:
			print('NO')
			flag = True
			break
	if flag == False:
		print('YES')


for t in range(int(input())):
	n = int(input())
	a = sorted([*map(int, input().split())])
	da = [a[i] - a[i - 1] for i in range(1, n)]
	if da.count(1) + da.count(0) != n:
		print(['NO', 'YES'][da.count(1) + da.count(0) == n - 1])


def judge(a) -> str:
	length = len(a)
	max_num = max(a)
	min_num = min(a)
	ll = []
	if length == 1:
		return 'YES'
	else:
		for i in range(min_num + 1, max_num):
			if i in a:
				ll.append(1)
			else:
				ll.append(0)
		if 0 in ll:
			return 'NO'
		else:
			return 'YES'

def main():
	numbers = []
	times = int(input())
	for i in range(times):
		cap = int(input())
		new_arr = input().split()
		for counter in range(0, cap):
			new_arr[counter] = int(new_arr[counter])
		numbers.append(new_arr)
	for arr in numbers:
		print(judge(arr))
main()


from collections import Counter
import math
import sys
from bisect import bisect, bisect_left, bisect_right

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

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def mod():
	return 10 ** 9 + 7
for i in range(INT()):
	n = INT()
	a = LIST()
	a.sort()
	flag = 0
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


for i in range(int(input())):
	n = int(input())
	a = input()
	a = a.split()
	map_object = map(int, a)
	a = list(map_object)
	a.sort()
	v1 = a[0]
	YESS = True
	for j in range(1, len(a)):
		v2 = a[j]
		if v1 - v2 > 1 or v2 - v1 > 1:
			YESS = False
			break
		v1 = v2
	if YESS == True:
		print('YES')
	else:
		print('NO')


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


a = int(input())
for i in range(a):
	b = int(input())
	c = sorted(list(map(int, input().split())))
	d = 0
	if b == 1:
		print('YES')
	else:
		for j in range(b - 1):
			if abs(c[j] - c[j + 1]) == 0 or abs(c[j] - c[j + 1]) == 1:
				d += 1
		if d == b - 1:
			print('YES')
		else:
			print('NO')


def possible(nums):
	if len(nums) == 1:
		return True
	if len(nums) == 2:
		return abs(nums[1] - nums[0]) <= 1
	nums.sort()
	for k in range(len(nums) - 1):
		if abs(nums[k] - nums[k + 1]) > 1:
			return False
	return True
t = int(input())
for k in range(t):
	n = int(input())
	nums = list(map(int, input().split()))
	if possible(nums):
		print('YES')
	else:
		print('NO')


b = int(input())
for _ in range(b):
	a = int(input())
	c = list(map(int, input().split()))
	c.sort()
	q = 0
	for j in range(a - 1):
		if c[j + 1] - c[j] > 1:
			q += 1
	if q >= 1:
		print('NO')
	else:
		print('YES')
	c = ()


n = int(input())
for i in range(n):
	m = int(input())
	arr = sorted(list(map(int, input().split())))
	yes = True
	for j in range(1, m):
		if arr[j] - arr[j - 1] > 1:
			yes = False
	if yes == True:
		print('YES')
	else:
		print('NO')


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


def solve(arr, n):
	arr.sort(reverse=True)
	for i in range(1, n):
		if abs(arr[i] - arr[i - 1]) > 1:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	print(solve(arr, n))


def remove(a):
	stack = []
	for val in a:
		stack.append(val)
		if len(stack) >= 2:
			(val1, val2) = (stack[-1], stack[-2])
			if abs(val1 - val2) <= 1:
				stack.pop()
				stack.pop()
				stack.append(val)
	return stack
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	result = remove(a)
	if len(result) == 1:
		print('YES')
	else:
		print('NO')


test_case = int(input())
for _ in range(test_case):
	n = int(input())
	a = sorted(map(int, input().split()))
	diff_sum = sum([a[i + 1] - a[i] <= 1 for i in range(n - 1)])
	print('YES' if diff_sum == n - 1 or n == 1 else 'NO')


import sys
input = sys.stdin.readline
print = sys.stdout.write

def getArr():
	return [int(x) for x in input().split()]

def check(Array):
	for cur in range(1, len(Array)):
		if Array[cur] - Array[cur - 1] > 1:
			return False
	return True
for NaN in range(int(input())):
	input()
	print('YES\n' if check(sorted(getArr())) else 'NO\n')


def analyzeArray(arr):
	if len(arr) == 1:
		return 'YES'
	for j in range(len(arr) - 1):
		if abs(arr[j] - arr[j + 1]) > 1:
			return 'NO'
	return 'YES'
count = int(input())
for i in range(count):
	с = input()
	arr = sorted(list(map(int, input().split())))
	print(analyzeArray(arr))


tc = int(input())
while tc > 0:
	n = int(input())
	numbers = map(int, input().split())
	sorted_numbers = sorted(numbers)
	flag = 0
	for i in range(len(sorted_numbers) - 1):
		if abs(sorted_numbers[i] - sorted_numbers[i + 1]) < 2:
			continue
		else:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')
	tc = tc - 1


_ = int(input())
result = []
for i in range(_):
	n = int(input())
	a = list(map(int, input().split(' ')))
	a.sort()
	while n >= 0:
		if n > 1:
			if a[0] <= a[1]:
				if abs(a[0] - a[1]) == 1 or abs(a[0] - a[1]) == 0:
					a.pop(0)
		n -= 1
	if len(a) > 1:
		result.append('NO')
	elif len(a) == 1:
		result.append('YES')
for i in result:
	print(i)


def stdin(t):
	for _ in range(t):
		n = int(input())
		m = sorted([int(x) for x in input().split()][:n])
		print(main(m, n))

def main(obj, n):
	idx = 1
	while idx < n:
		if obj[idx] - obj[idx - 1] <= 1:
			obj.pop(idx - 1)
			n -= 1
		else:
			return 'NO'
	return 'YES'
stdin(int(input()))


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


d = {}

def cleard():
	for i in range(1, 101):
		d[i] = False

def f(a):
	for i in a:
		d[i] = True
	c = 0
	for i in range(1, 100):
		if d[i] != d[i + 1]:
			c += 1
	if c <= 2:
		print('YES')
	else:
		print('NO')
t = int(input())
for i in range(t):
	input()
	a = map(int, input().split())
	cleard()
	f(a)


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter
from collections import deque
from heapq import heappush, heappop
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
t = ip()
for _ in range(t):
	n = ip()
	arr = list(inp())
	arr.sort()
	while True:
		if len(arr) == 1:
			flag = True
			break
		elif arr[0] == arr[1]:
			del arr[0]
		elif arr[0] + 1 == arr[1]:
			del arr[0]
		else:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


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


t = int(input())
for i in range(t):
	n = int(input())
	Case = False
	ar = list(sorted(map(int, input().rstrip().split(' '))))
	Case = 'YES'
	for i in range(n - 1):
		if abs(ar[i] - ar[i + 1]) > 1:
			Case = 'NO'
			break
	print(Case)


for i in range(int(input())):
	inp = int(input())
	list_n = list(map(int, input().split(' ')))
	flag = 0
	l = min(list_n)
	list_n = list(set(list_n))
	if len(list_n) == 1:
		print('YES')
	elif list_n.count(l) == len(list_n):
		print('YES')
	else:
		for j in range(len(list_n)):
			if l in list_n:
				l = l + 1
				continue
			else:
				print('NO')
				flag = 1
				break
		if flag == 0:
			print('YES')


def saurabh(a, n):
	a.sort()
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			return 'NO'
	return 'YES'
for i in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()][:n]
	print(saurabh(a, n))


T = int(input())
for i in range(T):
	N = int(input())
	lst = list(map(int, input().split()))
	if N == 1:
		print('YES')
	else:
		flag = 0
		lst.sort()
		for j in range(len(lst) - 1):
			if abs(lst[j] - lst[j + 1]) > 1:
				flag = 1
				break
		if flag == 1:
			print('NO')
		else:
			print('YES')


T = int(input())
for t in range(1, T + 1):
	N = int(input())
	lst = input().split()
	for i in range(N):
		lst[i] = int(lst[i])
	lst.sort()
	for i in range(N):
		for j in range(N - 1):
			if abs(lst[j + 1] - lst[j]) <= 1:
				lst.remove(lst[j])
				N -= 1
				break
	if N == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = False
	a.sort()
	for i in range(1, n):
		if abs(a[i - 1] - a[i]) > 1:
			print('NO')
			c = True
			break
	if not c:
		print('YES')


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


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().strip().split(' ')))
	li = []
	a.sort()
	for i in range(1, n):
		li.append(a[i] - a[i - 1])
	if all((v <= 1 for v in li)):
		print('YES')
	else:
		print('NO')


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


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	q = min(a)
	w = max(a)
	flag = True
	for i in range(q, w + 1):
		if i not in a:
			flag = False
	if flag == True:
		print('YES')
	else:
		print('NO')


a = int(input())
for x in range(a):
	n = input()
	n = [int(x) for x in input().split(' ')]
	n.sort()
	for y in range(len(n)):
		try:
			if abs(n[y] - n[y + 1]) <= 1:
				if n[y] > n[y + 1]:
					(n[y], n[y + 1]) = (n[y + 1], n[y])
				continue
			print('NO')
			break
		except:
			print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	b = [0] * max(a)
	for i in range(n):
		b[a[i] - 1] += 1
	flag = True
	for i in range(max(a)):
		if b[i] == 0 and sum(b[:i]) > 0:
			flag = False
	if len(set(a)) == 1:
		flag = True
	if n == 1:
		flag = True
	print('YES' if flag else 'NO')


def solve():
	b = int(input())
	c = list(map(int, input().split()))
	summa = 0
	c = sorted(c)
	for i in range(len(c) - 1):
		if c[i + 1] - c[i] > 1:
			summa += 1
			break
	if summa == 1:
		print('NO')
	else:
		print('YES')
a = int(input())
for i in range(a):
	solve()


kol = int(input())
for i in range(kol):
	n = int(input())
	string = sorted([int(i) for i in input().split()])
	kol = 0
	for i in range(len(string) - 1):
		if abs(string[i] - string[i + 1]) <= 1:
			kol += 1
	if n - kol == 1:
		print('YES')
	else:
		print('NO')


def ans(a, n):
	if n == 1:
		return 'YES'
	a.sort()
	i = 0
	j = 1
	count = 0
	max_diff = -1
	while j < len(a):
		diff = a[j] - a[i]
		if diff > max_diff:
			max_diff = diff
		i += 1
		j += 1
	if max_diff > 1:
		return 'NO'
	return 'YES'
m = int(input())
for i in range(m):
	n = int(input())
	arr = input().split()
	a = []
	for i in arr:
		a.append(int(i))
	print(ans(a, n))


t = int(input())
from collections import Counter

def check(c):
	left = 0
	for k in c:
		if not left:
			if c[k + 1] == 0:
				left += 1
		elif c[k + 1] == 0:
			return False
	return True
for _ in range(t):
	n = int(input())
	arr = map(int, input().split())
	c = Counter(arr)
	if check(c):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	input()
	lis = [*map(int, input().split())]
	lis.sort()
	yes = True
	key = lis[0]
	for i in range(1, len(lis)):
		if lis[i] - key <= 1:
			key = lis[i]
		else:
			yes = False
			break
	print('YES' if yes else 'NO')


t = int(input())
for x in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	ans = []
	l.sort()
	for i in range(n - 1):
		c = min(l[i], l[i + 1])
		if abs(l[i] - l[i + 1]) <= 1:
			ans.append(c)
	if len(l) - len(ans) == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = sorted([int(x) for x in input().split()])
	f = True
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			f = False
			break
	if f:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
import bisect
n = int(stdin.readline())
for i in range(n):
	a = int(stdin.readline())
	lst = [int(i) for i in stdin.readline().split()]
	lst.sort()
	ans = 'YES'
	temp = lst[0]
	for i in lst[1:]:
		if i - temp > 1:
			ans = 'NO'
			break
		temp = i
	stdout.write(str(ans) + '\n')


from sys import stdin

def main():
	input = lambda : stdin.readline()[:-1]
	T = int(input())
	for _ in [0] * T:
		N = int(input())
		A = list(map(int, input().split()))
		A.sort()
		for i in range(N - 1):
			if A[i + 1] - A[i] > 1:
				print('NO')
				break
		else:
			print('YES')
main()


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


for _ in range(int(input())):
	n = int(input())
	arr = sorted(list(map(int, input().split())))
	if n <= 1:
		print('YES')
		continue
	for i in range(1, n):
		if arr[i] - arr[i - 1] > 1:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	q = 1
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			q = 0
			ans.append('NO')
			break
	if q == 1:
		ans.append('YES')
		m = min(a)
for i in ans:
	print(i)


def is_possible(number_list):
	for index in range(0, len(number_list) - 1):
		if abs(number_list[index] - number_list[index + 1]) > 1:
			return 'NO'
	return 'YES'
t = int(input())
while t > 0:
	n = int(input())
	numbers = []
	arr = input().split()
	for i in range(0, n):
		numbers.append(int(arr[i]))
	numbers.sort()
	print(is_possible(numbers))
	t -= 1


n = int(input())
for i in range(n):
	k = int(input())
	l = list(map(int, input().split()))
	l.sort()
	bool = True
	for i in range(k - 1):
		if abs(l[i] - l[i + 1]) > 1:
			print('NO')
			bool = False
			break
	if bool:
		print('YES')


t = int(input())
while t:
	t -= 1
	m = int(input())
	lst = list(map(int, input().split(' ')))
	lst.sort()
	flag = False
	for i in range(len(lst) - 1):
		if lst[i + 1] - lst[i] > 1:
			flag = True
			break
	if flag == True:
		print('NO')
	else:
		print('YES')


def solve(arr, n) -> bool:
	arr.sort()
	for i in range(1, n):
		if arr[i] - arr[i - 1] > 1:
			return False
	return True
num_test_cases = int(input())
res = []
while num_test_cases > 0:
	length = int(input())
	arr = input().split(' ')
	A = [int(n) for n in arr]
	res.append(solve(A, length))
	num_test_cases -= 1
for _bool in res:
	if _bool:
		print('YES')
	else:
		print('NO')


t = int(input())
for ii in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	valid = True
	for i in range(1, n):
		if a[i] - a[i - 1] <= 1:
			continue
		else:
			valid = False
	if valid:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	leng = int(input())
	l = list(map(int, input().strip().split()))
	l.sort()
	flag = 1
	for i in range(len(l) - 1):
		if l[i + 1] - l[i] >= 2:
			flag = 0
	if flag == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	brr = list(map(int, input().strip().split()))
	brr.sort()
	x = 0
	while True:
		if x < len(brr) - 1 and brr[x + 1] - brr[x] <= 1 and (len(brr) > 1):
			brr.pop(x)
		else:
			break
	if len(brr) == 1:
		print('YES')
	else:
		print('NO')


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


import collections
import itertools
import sys
from collections import defaultdict, Counter
from math import sqrt, ceil
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def main():
	n = inp()
	for _ in range(n):
		r = inp()
		v = inlt()
		v.sort()
		res = [v[0]]
		for vv in v[1:]:
			if vv - res[-1] <= 1:
				res[-1] = vv
			else:
				res.append(vv)
		print('YES' if len(res) == 1 else 'NO')
main()


def f(a):
	b = []
	while len(a) > 0:
		m = min(a)
		while m in a:
			a.remove(m)
		b.append(m)
	for i in range(len(b)):
		if i + 1 > len(b) - 1:
			return 'YES'
		if abs(b[i + 1] - b[i]) > 1:
			return 'NO'
no_tests = int(input())
for i in range(no_tests):
	n = int(input())
	obj = input()
	astr = obj.split()
	a = []
	for k in range(len(astr)):
		a.append(int(astr[k]))
	print(f(a))


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	arr = list(map(int, input().split(' ')))
	arr.sort()
	if len(arr) == 0:
		print('NO')
	elif len(arr) == 1:
		print('YES')
	else:
		i = 1
		while i < len(arr):
			if arr[i] - arr[i - 1] > 1:
				print('NO')
				break
			i += 1
		if i == len(arr):
			print('YES')


for i in range(int(input())):
	(_, a) = (input(), sorted([int(x) for x in input().split()]))
	for (i, j) in zip(a, a[1:]):
		if i < j - 1:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort()
	if n == 1:
		print('YES')
		continue
	check = False
	for i in range(n - 1):
		if arr[i + 1] - arr[i] > 1:
			check = True
			break
	if check:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().strip().split()))
	a.sort()
	m = {}
	for i in a:
		if m.get(i) == None:
			m[i] = 1
		else:
			m[i] += 1
	temp = []
	for i in range(n):
		temp.append(a[i])
	for i in range(n):
		if m.get(a[i]) != None:
			if m.get(a[i]) > 1:
				temp.pop(temp.index(a[i]))
				m[a[i]] -= 1
			elif m.get(a[i] + 1) != None:
				temp.pop(temp.index(a[i]))
				del m[a[i]]
	if len(temp) == 1:
		print('YES')
	else:
		print('NO')


import sys
import math, bisect
from collections import defaultdict
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, OrderedDict

def neo():
	return map(int, input().split())

def Neo():
	return list(map(int, input().split()))
for _ in range(int(input())):
	n = int(input())
	A = Neo()
	A.sort()
	f = 0
	for i in range(1, n):
		p = A[i] - A[i - 1]
		if abs(p) > 1:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	t = int(input())
	a = list(map(int, input().split()))
	b = sorted(a)
	if len(b) == 1:
		print('YES')
	else:
		for j in range(1, t):
			if abs(b[j - 1] - b[j]) > 1:
				print('NO')
				break
		else:
			print('YES')


def isthere(a):
	for i in range(len(a) - 1):
		if a[i + 1] - a[i] == 1:
			return a[i]
	for i in range(len(a) - 1):
		if a[i + 1] == a[i]:
			return a[i]
	return 0
n = int(input())
for i in range(n):
	x = int(input())
	a = list(map(int, input().split()))
	a.sort()
	while isthere(a):
		del a[a.index(isthere(a))]
	if len(a) == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	flag = 0
	if n == 1:
		print('YES')
	else:
		for i in range(n - 1):
			if abs(ar[i] - ar[i + 1]) == 1 or abs(ar[i] - ar[i + 1]) == 0:
				nothin = 1
			else:
				flag = 1
		if flag:
			print('NO')
		else:
			print('YES')


t = int(input())
for tt in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ok = 'YES'
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			ok = 'NO'
	print(ok)


t = int(input())

def solve(a):
	a.sort()
	c = 0
	while True:
		if len(a) == 1:
			return 'YES'
		if abs(a[0] - a[1]) <= 1:
			a = a[1:]
		else:
			return 'NO'

def li():
	return list(map(int, input().split()))
for i in range(t):
	n = int(input())
	a = li()
	print(solve(a))


import sys
from collections import defaultdict
mod = 10 ** 9 + 7
sys.setrecursionlimit(10 ** 8)
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))
t = inp()
for _ in range(t):
	n = inp()
	a = inpl()
	a.sort()
	res = True
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			res = False
	print('YES' if res else 'NO')


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


for ii in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	c = 0
	for i in range(n - 1):
		if a[i] - a[i + 1] > 1:
			c += 1
			print('NO')
			break
	if c == 0:
		print('YES')


def ispossible(n, arr):
	if n == 1:
		return 'YES'
	arr.sort()
	i = 0
	while n:
		try:
			if abs(arr[i] - arr[i + 1]) <= 1:
				arr.remove(arr[i])
			else:
				i += 1
		except:
			pass
		n -= 1
	try:
		if abs(arr[i] - arr[i + 1]) <= 1:
			arr.remove(arr[i])
			print(arr)
	except:
		pass
	if len(arr) == 1:
		return 'YES'
	else:
		return 'NO'
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(ispossible(n, a))


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


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


t = int(input())
for i in range(t):
	q = 0
	m = int(input())
	s = input()
	n = [int(s) for s in s.split()]
	n = sorted(n)
	for j in range(m - 1):
		if abs(n[j] - n[j + 1]) > 1:
			q = 1
			break
	if q == 1:
		print('NO')
	else:
		print('YES')


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 1000000007

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	n = Int()
	a = sorted(array())
	ok = True
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) > 1:
			ok = False
			break
	if ok:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout

def input():
	return stdin.readline()

def prin(x):
	return stdout.write(str(x) + '\n')
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(k) for k in input().split()]
	a.sort()
	flag = 0
	if n == 1:
		print('YES')
	else:
		for i in range(1, n):
			if abs(a[i - 1] - a[i]) <= 1:
				pass
			else:
				flag = 1
		if flag:
			print('NO')
		else:
			print('YES')


def small(b, m):
	l = len(b)
	x = b[0]
	for i in range(0, m):
		if abs(b[i] - x) > 1:
			return 'NO'
		x = b[i]
	return 'YES'
for i in range(int(input())):
	m = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	print(small(ar, m))


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	i = 0
	while i < len(a) - 1:
		if a[i + 1] - a[i] <= 1:
			del a[i]
		else:
			i += 1
	if len(a) == 1:
		print('YES')
	else:
		print('NO')


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


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


import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
import itertools

def Int():
	return int(sys.stdin.readline())

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

def Lstr():
	return list(sys.stdin.readline().strip())

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

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

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

def Hash():
	return dict()

def Mod():
	return 1000000007

def Ncr(n, r, p):
	return fact[n] * (ifact[r] * ifact[n - r] % p) % p

def Most_frequent(list):
	return max(set(list), key=list.count)

def Mat2x2(n):
	return [List() for _ in range(n)]

def Lcm(x, y):
	return x * y // gcd(x, y)

def dtob(n):
	return bin(n).replace('0b', '')

def btod(n):
	return int(n, 2)

def common(l1, l2):
	return set(l1).intersection(l2)

def solution():
	for _ in range(Int()):
		n = Int()
		a = List()
		a.sort()
		ans = a[0]
		p = 0
		for i in range(1, n):
			if a[i] - ans > 1:
				p = 1
				break
			ans = a[i]
		if p == 0:
			print('YES')
		elif p == 1:
			print('NO')
solution()


import math
import sys
import heapq
from collections import deque, defaultdict
from itertools import permutations, combinations, combinations_with_replacement
from sys import *
import random
import os
mod = 10 ** 9 + 7
MAX = sys.maxsize
MIN = -sys.maxsize - 1

def isPrime(n):
	if n > 1:
		for i in range(2, n):
			if n % i == 0:
				return False
		else:
			return True
	else:
		return False

def isPanagram(s):
	alphabet = 'abcdefghijklmnopqrstuvwxyz'
	for char in alphabet:
		if char not in s.lower():
			return False
	return True

def diff(list1):
	res = [list1[i + 1] - list1[i] for i in range(len(list1) - 1)]
	return res

def isEqual(list1):
	if len(list1) < 0:
		res = True
	res = all((ele == list1[0] for ele in len(list1)))
	if res:
		return True
	else:
		return False

def remove_duplicate(list1):
	final_list = []
	for i in list1:
		if i not in final_list:
			final_lis.append(i)
	return final_list

def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	if len(arr) == 1:
		return 'YES'
	if all((i == arr[0] for i in arr)):
		return 'YES'
	else:
		res = diff(arr)
		if any((i > 1 for i in res)):
			return 'NO'
		else:
			return 'YES'
t = int(stdin.readline())
for i in range(t):
	result = solve()
	stdout.write(str(result) + '\n')


t = int(input())
for i in range(t):
	n = int(input())
	ls = [int(a) for a in input().split()]
	ls.sort()
	bp = False
	for j in range(n - 1):
		if ls[j + 1] - ls[j] > 1:
			bp = True
			break
	if bp:
		print('NO')
	else:
		print('YES')


try:
	t = int(input())
	while t != 0:
		n = int(input())
		arr = list(map(int, input().split()))
		arr = set(arr)
		arr = list(arr)
		arr.sort()
		if len(arr) == 1:
			print('YES')
		else:
			s = 1
			for i in range(len(arr) - 1):
				if arr[i + 1] - arr[i] > 1:
					s = 0
					break
			if s == 0:
				print('NO')
			else:
				print('YES')
		t = t - 1
except EOFError:
	print(' ')


def helper(a):
	if len(a) == 1:
		print('YES')
	else:
		a.sort()
		for i in range(1, len(a)):
			if abs(a[i] - a[i - 1]) > 1:
				print('NO')
				return None
		print('YES')
big_n = int(input())
for _ in range(big_n):
	l = int(input())
	row = [int(x) for x in input().split(' ')]
	helper(row)


def t1(l):
	f = 0
	while len(l) != 1:
		i = 0
		while i < len(l):
			if abs(l[i] - l[i + 1]) <= 1:
				m = min(l[i], l[i + 1])
				l.remove(m)
			else:
				f = 1
				break
			i += 1
			if i == len(l) - 1 or len(l) == 1:
				break
		if f == 1:
			break
	if len(l) == 1:
		print('YES')
	else:
		print('NO')
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().strip().split()))
	i = 0
	f = 0
	l.sort()
	while i < len(l) - 1:
		if abs(l[i] - l[i + 1]) <= 1:
			pass
		else:
			f = 1
			break
		i += 1
	if f == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	line = list(map(int, input().split()))
	line.sort()
	last_symbol = line[0]
	flag = True
	for i in range(1, len(line)):
		if line[i] - last_symbol > 1:
			flag = False
		last_symbol = line[i]
	if flag:
		print('YES')
	else:
		print('NO')


def main():
	t = int(input())
	while t > 0:
		t = t - 1
		n = int(input())
		if n == 1:
			z = input()
			print('YES')
		elif n == 0:
			print('NO')
		else:
			a = [0 for k in range(n)]
			a = list(map(int, input().strip().split()))
			a.sort()
			check = 0
			for i in range(n - 1):
				temp = a[i + 1] - a[i]
				if temp > 1:
					check = 1
					break
			if check == 1:
				print('NO')
			else:
				print('YES')
main()


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr = list(set(arr))
	n = len(arr)
	arr.sort()
	ans = 'YES'
	for i in range(1, n):
		if arr[i] - arr[i - 1] > 1:
			ans = 'NO'
			break
	print(ans)


def check(n, a):
	a = sorted(a)
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			return 'NO'
	return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(check(n, a))


from math import *
from copy import *
from string import *
from random import *
from sys import stdin, stdout
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math
import math
import time
from queue import Queue

def seive(n):
	l = [True]
	l = l * (n + 1)
	for i in range(2, int(sqrt(n)) + 1):
		if l[i] == True:
			val = i * i
			while val < len(l):
				l[val] = False
				val += i
	prime = []
	for i in range(2, len(l)):
		if l[i] == True:
			prime.append(i)
	return prime

def dp(l, i, n, val, ans):
	if i >= n or val < 0:
		return 1000000
	elif val == 0:
		return 0
	else:
		if ans[i] == 1000000:
			ans[i] = min(min(1 + dp(l, i + 1, n, val - l[i], ans), 1 + dp(l, i, n, val - l[i], ans)), dp(l, i + 1, n, val, ans))
		return ans[i]
from queue import Queue

def factors(n):
	l = []
	for i in range(1, int(sqrt(n)) + 1):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def check1(s, v, x):
	while True:
		if v not in s:
			return v
		else:
			v -= 1

def check2(s, v, x):
	while True:
		if v not in s:
			return v
		else:
			v += 1

def up(n):
	j = n - 1
	while j > 0:
		if n % j == 0:
			break
		j -= 1
	return j

def fac(n):
	c = 1
	i = 1
	while i <= n:
		c *= i
		i += 1
	return c

def check_happy(n):
	ss = set()
	print(n)
	while n != 1:
		val = n
		s = 0
		print(val)
		while val != 0:
			s += (val % 10) ** 2
			val = val // 10
		print(val)
		print('hi')
		if val in ss:
			return False
		else:
			n = val
			ss.add(n)
	return True

def update(a, b):
	c = 1
	val = a
	while a < b:
		print(c, a)
		c += c
		a += a
	print(1)
	while a > b:
		print()
		a -= val
		c -= 1
	return c
import random as rand

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
from itertools import permutations

def insertion_sort(arr):
	for i in range(len(arr)):
		j = i
		while j > 0:
			if arr[j] < arr[j - 1]:
				temp = arr[j]
				arr[j] = arr[j - 1]
				arr[j - 1] = temp
			j -= 1
	return arr

def quick_sort(arr, low, high):
	i = low
	j = high
	while i < j:
		if arr[i] > arr[low] and arr[j] < arr[low]:
			temp = arr[i]
			arr[i] = arr[j]
			arr[j] = arr[i]
			i += 1
			j -= 1
		elif arr[i] <= arr[low]:
			i += 1
		elif arr[j] >= arr[low]:
			j -= 1
	print(i, j)
	toto = arr[j]
	arr[j] = arr[low]
	arr[low] = toto
	return j

def dodo(arr, low, high):
	if low < high:
		val = quick_sort(arr, low, high)
		dodo(arr, low, val - 1)
		dodo(arr, val + 1, high)

def dp(arr, c, n, k, z, ans):
	if k == 0:
		return ans
	elif c == 0:
		return dp(arr, c + 1, n, k - 1, z, ans + arr[c + 1])
	elif c == n - 1:
		if z == 0:
			return 0
		else:
			return dp(arr, c - 1, n, k - 1, z - 1, ans + arr[c - 1])
	elif z == 0:
		return dp(arr, c + 1, n, k - 1, z, ans + arr[c + 1])
	else:
		return max(dp(arr, c + 1, n, k - 1, z, ans + arr[c + 1]), dp(arr, c - 1, n, k - 1, z - 1, ans + arr[c - 1]))
t = int(stdin.readline())
for i in range(t):
	n = int(stdin.readline())
	l = list(map(int, stdin.readline().split(' ')))
	l.sort()
	boo = True
	for i in range(1, n):
		if abs(l[i] - l[i - 1]) > 1:
			boo = False
			break
	if boo:
		print('YES')
	else:
		print('NO')


def solve():
	n = int(input())
	a = sorted(map(int, input().split()))
	ok = True
	for i in range(1, n):
		if a[i - 1] != a[i] and a[i - 1] + 1 != a[i]:
			ok = False
			break
	print('YES' if ok else 'NO')
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	arr = sorted([int(j) for j in input().split()])
	while True:
		if len(arr) == 1:
			print('YES')
			break
		if arr[1] - arr[0] <= 1:
			arr.pop(0)
		else:
			print('NO')
			break


def check(arrayList):
	arrayList.sort()
	result = 'YES'
	for item in range(0, len(arrayList) - 1):
		if arrayList[item + 1] - arrayList[item] > 1:
			result = 'NO'
			break
	print(result)
t = int(input())
for i in range(0, t):
	n = int(input())
	lists = list((int(num) for num in input().strip().split()))[:n]
	check(lists)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	f = list(set(a))
	f.sort()
	ans = 'YES'
	for i in range(1, len(f)):
		if f[i] - f[i - 1] > 1:
			ans = 'NO'
			break
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	a = {int(x) for x in input().split()}
	a = sorted(a)
	prev = a[0]
	i = 1
	c = 0
	while len(a) > 1:
		if abs(prev - a[i]) <= 1:
			a.remove(min(prev, a[i]))
			prev = a[0]
		else:
			print('NO')
			c = 1
			break
	if c == 0 and len(a) == 1:
		print('YES')


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		if n == 1:
			print('YES')
			continue
		a.sort()
		flag = False
		for i in range(n - 1):
			if a[i] + 1 == a[i + 1] or a[i] == a[i + 1]:
				continue
			else:
				flag = True
		if flag:
			print('NO')
		else:
			print('YES')
main()


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


test = int(input())
while test:
	n = int(input())
	l = [int(x) for x in input().split(' ')]
	l.sort(reverse=True)
	i = n - 1
	while i > 0:
		if l[i - 1] - l[i] <= 1:
			l[i] = -5
		i -= 1
	test -= 1
	i = 0
	count = 0
	while i < n:
		if l[i] > 0:
			count += 1
		i += 1
	if count == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	_ = int(input())
	array = sorted(map(int, input().split()))
	for (a, b) in zip(array, array[1:]):
		if b - a > 1:
			print('NO')
			break
	else:
		print('YES')


for x in range(int(input())):
	n = int(input())
	lst = sorted(list(map(int, input().split())))
	f = list()
	i = 1
	while i < n:
		if lst[i] - lst[i - 1] <= 1 and lst[i] - lst[i - 1] > 0:
			f.append(min(lst[i], lst[i - 1]))
		elif lst[i] - lst[i - 1] == 0:
			f.append(lst[i])
		i += 1
	if len(lst) - len(f) == 1:
		print('YES')
	else:
		print('NO')


def solve(n, arr):
	arr.sort()
	for i in range(1, n):
		if arr[i] - arr[i - 1] > 1:
			return 'NO'
	return 'YES'
t = int(input())
results = []
for _ in range(0, t):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	results.append(solve(n, arr))
for result in results:
	print(result)


n = int(input())
for _ in range(n):
	n1 = int(input())
	ll = list(map(int, input().split()))
	ll = sorted(ll)
	max = 0
	for i in range(n1 - 1):
		if abs(ll[i] - ll[i + 1]) > max:
			max = abs(ll[i] - ll[i + 1])
	if max > 1:
		print('NO')
	else:
		print('YES')


import math

def facts(n):
	ans = []
	for i in range(2, int(math.sqrt(n) + 1)):
		if n % i == 0:
			ans.append(i)
			ans.append(n // i)
	ans = sorted(ans)
	return ans
for _ in range(int(input())):
	n = int(input())
	nms = list(map(int, input().split()))
	nms = sorted(nms)
	ans = 0
	state = n
	for i in range(n - 1):
		if abs(nms[i] - nms[i + 1]) == 1 or abs(nms[i] - nms[i + 1]) == 0:
			state -= 1
			if state == 1:
				break
	if state == 1:
		print('YES')
	else:
		print('NO')


ct = int(input())
while ct > 0:
	ct -= 1
	input()
	lis = list(map(int, input().split()))
	lis.sort()
	flag = True
	for i in range(len(lis) - 1):
		if lis[i + 1] - lis[i] > 1:
			flag = False
			break
	print('YES' if flag else 'NO')


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


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	n = inputnum()
	a = inputlist()
	a.sort()
	good = True
	for i in range(1, n):
		if a[i] - a[i - 1] >= 2:
			good = False
	if good:
		print('YES')
	else:
		print('NO')


test_cases = int(input())
for _ in range(test_cases):
	n = int(input())
	array = list(map(int, input().split()))
	if n == 1:
		print('YES')
		continue
	array.sort()
	look = True
	while look:
		look = False
		for i in range(len(array) - 1):
			if abs(array[i] - array[i + 1]) <= 1:
				look = True
				array.remove(array[i])
				break
		if look == False:
			if len(array) == 1:
				print('YES')
				break
			else:
				print('NO')
				break


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


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


t = int(input())

def solve(a):
	a = sorted(a)
	for i in range(len(a) - 1):
		if a[i + 1] - a[i] > 1:
			print('NO')
			return
	print('YES')
for i in range(t):
	input()
	a = map(int, input().split())
	solve(a)


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True
for _ in range(ii()):
	n = ii()
	a = sorted(li())
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			print('NO')
			break
	else:
		print('YES')


n = int(input())
for i in range(n):
	l = int(input())
	a = list(map(int, input().strip().split()))
	a.sort()
	f = 0
	for j in range(l - 1):
		if a[j] - a[j + 1] > 1 or a[j] - a[j + 1] < -1:
			f = 1
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


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


t = int(input())
for work in range(t):
	k = int(input())
	s = set(map(int, input().split()))
	mini = min(s)
	maxi = max(s)
	for i in range(mini, maxi):
		if i not in s:
			print('NO')
			break
	else:
		print('YES')


import sys
stdin = sys.stdin
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
ns = lambda : stdin.readline().rstrip()
t = ni()
for _ in range(t):
	n = ni()
	ar = sorted(na())
	prev = ar[0]
	flag = False
	for i in range(1, n):
		if ar[i] - prev > 1:
			flag = True
			break
		prev = ar[i]
	print('NO' if flag else 'YES')


for _ in range(int(input())):
	n = int(input())
	ni = [_ for _ in map(int, input().split())]
	ni.sort()
	flag = True
	for i in range(n - 1, 0, -1):
		if abs(ni[i] - ni[i - 1]) > 1:
			print('NO')
			flag = False
			break
	if flag:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	flag = True
	for j in range(n - 1):
		if a[j + 1] - a[j] > 1:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


def isOnlyOne(num_set):
	num_lst = sorted(num_set)
	length = len(num_lst)
	for i in range(length - 1):
		if num_lst[i + 1] - num_lst[i] > 1:
			print('NO')
			return
	print('YES')
t = int(input())
for _ in range(t):
	n = int(input())
	num_set = set(map(int, input().rstrip().split()))
	isOnlyOne(num_set)


t = int(input())
while t != 0:
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	count = 0
	while len(a) != 1:
		if abs(a[-1] - a[-2]) > 1:
			count = 1
			break
		a.pop()
	if count != 0:
		print('NO')
	else:
		print('YES')
	t = t - 1


import io
import os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def main():
	for t in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		ans = 'YES'
		for i in range(1, n):
			if a[i] - a[i - 1] > 1:
				ans = 'NO'
				break
		print(ans)
main()


try:
	for _ in range(int(input())):
		n = int(input())
		a = [int(i) for i in input().split()]
		s = 'YES'
		if n > 1:
			a.sort()
			for i in range(n - 1):
				if abs(a[i] - a[i + 1]) > 1:
					s = 'NO'
					break
		print(s)
except:
	pass


n = int(input())
l1 = []
l2 = []
for i in range(n):
	l1.append(int(input()))
	for j in range(1):
		l2.append([int(x) for x in input().split()])

def ans():
	for j in range(n):
		l2[j].sort()
		if len(l2[j]) < 2:
			print('YES')
		else:
			i = 0
			while i < l1[j] - 1:
				if l2[j][i + 1] - l2[j][i] < 2:
					if i == l1[j] - 2:
						print('YES')
				else:
					print('NO')
					break
				i = i + 1
	print()
ans()


def comp(l):
	l.sort()
	y = len(l)
	x = l[:]
	for i in range(0, len(x) - 1):
		v = x[i:i + 2]
		if v[1] - v[0] == 1 or v[1] - v[0] == 0:
			l.remove(v[0])
	if len(l) == 1:
		return 'YES'
	else:
		return 'NO'
y = input()
v = []
for l in range(0, int(y)):
	k = input()
	input_string = input()
	u = input_string.split()
	for i in range(0, len(u)):
		u[i] = int(u[i])
	v.append(u)
for b in v:
	print(comp(b))


import sys
import math
from functools import *
from itertools import *
from collections import *
sys.setrecursionlimit(10 ** 7)
ti = int(input())
for i in range(ti):
	ni = int(input())
	ai = sorted(map(int, input().split()))
	for i in range(1, ni):
		if ai[i] - ai[i - 1] > 1:
			print('NO')
			break
	else:
		print('YES')


def main():
	for _ in range(int(input())):
		en = int(input())
		aa = list((int(ex) for ex in input().split()))
		aa.sort()
		for ai in range(en - 1):
			if aa[ai + 1] - aa[ai] > 1:
				print('NO')
				break
		else:
			print('YES')
main()


t = int(input())
for i in range(0, t):
	n = int(input())
	arr = input().split()
	if n == 1:
		print('YES')
	else:
		for i in range(n):
			arr[i] = int(arr[i])
		arr.sort()
		possible = True
		for i in range(1, n):
			if abs(arr[i] - arr[i - 1]) > 1:
				possible = False
				print('NO')
				break
		if possible == True:
			print('YES')


test = int(input())
for _ in range(test):
	input()
	arr = list(map(int, input().split()))
	arr.sort()
	l = len(arr)
	if l == 1:
		print('YES')
		continue
	else:
		noflag = False
		for i in range(1, l):
			if arr[i] - arr[i - 1] > 1:
				noflag = True
				break
	if noflag:
		print('NO')
	else:
		print('YES')


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


from sys import stdin
t = int(input())
for _ in range(t):
	n = int(input())
	nums = [int(x) for x in stdin.readline().split()]
	nums.sort()
	for i in range(n - 1):
		if nums[i + 1] - nums[i] > 1:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	o = []
	if n == 1:
		print('YES')
	else:
		i = 1
		while i < len(l):
			o.append(abs(l[i] - l[i - 1]))
			i = i + 1
		o.sort()
		if o[-1] == 1 or o[-1] == 0:
			print('YES')
		else:
			print('NO')


t = int(input())
while t > 0:
	n = int(input())
	a = input().split(' ')
	i = 0
	j = 1
	for b in range(n):
		a[b] = int(a[b])
	a.sort()
	while i <= len(a) - 2 and j <= len(a) - 1:
		if i != j and abs(int(a[i]) - int(a[j])) <= 1:
			a.remove(min(int(a[i]), int(a[j])))
			i = 0
			j = i + 1
		elif j == len(a) - 1:
			i += 1
			j = i + 1
		else:
			j += 1
	if len(a) == 1:
		print('YES')
	else:
		print('NO')
	t -= 1


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


import sys, bisect, string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby
rep = range
R = range

def Golf():
	(n, *t) = map(int, open(0).read().split())

def I():
	return int(input())

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

def MI():
	return map(int, input().split())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def Ra():
	return map(int, open(0).read().split())

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in range(V)]
	FromStdin = True if ls == None else False
	for i in range(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in R(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def accum(ls):
	rt = [0]
	for i in ls:
		rt += [rt[-1] + i]
	return rt

def bit_combination(n, base=2):
	rt = []
	for tb in R(base ** n):
		s = [tb // base ** bt % base for bt in R(n)]
		rt += [s]
	return rt

def gcd(x, y):
	if y == 0:
		return x
	if x % y == 0:
		return y
	while x % y != 0:
		(x, y) = (y, x % y)
	return y

def YN(x):
	print(['NO', 'YES'][x])

def Yn(x):
	print(['No', 'Yes'][x])

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
mo = 10 ** 9 + 7
inf = float('inf')
FourNb = [(-1, 0), (1, 0), (0, 1), (0, -1)]
EightNb = [(-1, 0), (1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('WENS', FourNb))
cursol = dict(zip('LRUD', FourNb))
l_alp = string.ascii_lowercase
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
input = lambda : sys.stdin.readline().rstrip()
show_flg = False
show_flg = True
ans = 0
show_flg = False
show_flg = True
ans = 0
for _ in range(I()):
	n = I()
	k = 1
	a = sorted(LI())
	for (i, j) in zip(a, a[1:]):
		if abs(i - j) > 1:
			k = 0
	YN(k)


for _ in range(int(input())):
	n = int(input())
	l = sorted(map(int, input().split()))
	while len(l) > 1 and l[-1] - l[-2] <= 1:
		l.pop()
	if len(l) == 1:
		print('YES')
	else:
		print('NO')


t = int(input(''))
while t != 0:
	n = int(input(''))
	x = input('')
	l = x.split()
	for i in range(len(l)):
		l[i] = int(l[i])
	for i in range(len(l) - 1):
		for j in range(i + 1, len(l)):
			if l[i] > l[j]:
				(l[i], l[j]) = (l[j], l[i])
	for i in l[:len(l) - 1]:
		x = l.index(i)
		if i + 1 == l[x + 1] or i == l[x + 1]:
			l.remove(i)
	if len(l) == 1:
		print('YES')
	else:
		print('NO')
	t -= 1


def fuck(A):
	if len(A) == 1:
		print('YES')
		return
	A.sort()
	for i in range(len(A) - 1):
		if abs(A[i] - A[i + 1]) <= 1:
			continue
		else:
			print('NO')
			return
	print('YES')
	return
t = int(input())
for i in range(t):
	n = int(input())
	A = [int(i) for i in input().split()][:n]
	fuck(A)


for i in range(int(input())):
	ans = 'YES'
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print('YES')
		continue
	a.sort()
	for j in range(n - 1):
		if a[j + 1] - a[j] > 1:
			ans = 'NO'
			continue
	print(ans)


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


T = int(input())
for t in range(T):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	flag = 1
	i = 0
	if len(a) == 1:
		print('YES')
	else:
		while len(a) != 1 and flag == 1:
			flag = 0
			while i < len(a) - 1:
				if a[i] == a[i + 1] - 1 or a[i] == a[i + 1] + 1 or a[i] == a[i + 1]:
					a.remove(min(a[i], a[i + 1]))
					flag = 1
				else:
					i += 1
			if i >= len(a) - 1:
				i = 0
		if len(a) == 1:
			print('YES')
		else:
			print('NO')


T = input()
T = int(T)
for t in range(0, T):
	n = input()
	n = int(n)
	arr = list(map(int, input().split()))
	arr.sort()
	if n == 1:
		print('YES')
	else:
		count = -123
		for i in range(0, n - 1):
			if arr[i + 1] - arr[i] >= 2:
				count = i
				break
		if count != -123:
			print('NO')
		else:
			print('YES')


import math
import os
import random
import re
import sys

def fun(arr, n):
	arr.sort()
	result = None
	for i in range(1, n):
		if arr[i] - arr[i - 1] > 1:
			result = 'NO'
			break
		else:
			continue
	if result == None:
		result = 'YES'
	return result
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	result = fun(arr, n)
	print(result)


T = int(input())

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


t = int(input())
while t > 0:
	flag = 0
	n = int(input())
	lst = list(map(int, input().split()))
	lst = sorted(lst)
	prev = lst[0]
	for i in range(1, len(lst)):
		if abs(prev - lst[i]) > 1:
			flag = 1
			print('NO')
			break
		prev = lst[i]
	if flag == 0:
		print('YES')
	t -= 1


T = int(input())
while T:
	T -= 1
	N = int(input())
	lis = list(map(int, input().split()))
	lis.sort()
	flag = 0
	for i in range(1, len(lis)):
		if lis[i] - lis[i - 1] > 1:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


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


from sys import stdin

def main():
	iint = int
	llist = list
	sset = set
	ssorted = sorted
	mmap = map
	mmin = min
	input = stdin.readline
	t = iint(input())
	for i in range(t):
		n = iint(input())
		arr = llist(mmap(iint, input().split()))
		arr = ssorted(sset(arr))
		if len(arr) == 1:
			print('YES')
			continue
		ans = 0
		i = 0
		while i < len(arr) - 1:
			if abs(arr[i] - arr[i + 1]) > 1:
				ans = ans + 1
				i = i + 1
			else:
				del arr[i]
				i = i
			if ans == 2:
				print('NO')
				break
		else:
			if len(arr) >= 2:
				print('NO')
			else:
				print('YES')
main()


t = int(input())
while t != 0:
	n = int(input())
	a = list(map(int, input().split()))[:n]
	yes = 0
	a.sort()
	if len(a) == 1:
		print('YES')
		t -= 1
		continue
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) <= 1 and abs(a[i] - a[i + 1]) >= 0:
			yes = 1
		else:
			yes = 0
			break
	if yes == 0:
		print('NO')
	else:
		print('YES')
	t -= 1


tests = int(input())
for t in range(tests):
	n = int(input())
	arr = list(map(int, input().split()))
	arr = sorted(arr)
	curr = arr[0]
	check = True
	for item in arr[1:]:
		if item - curr > 1:
			check = False
			break
		else:
			curr = item
	if check:
		print('YES')
	else:
		print('NO')


from math import *
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	i = 0
	f = 0
	while i < len(a) - 1:
		if a[i + 1] - a[i] <= 1:
			a.remove(a[i])
		else:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	n = int(input())
	ls = [0] * n
	ls = list(map(int, input().split()))
	di = {}
	for i in range(n):
		if ls[i] not in di:
			di[ls[i]] = 1
		else:
			di[ls[i]] = di[ls[i]] + 1
	for i in di:
		if di[i] > 1:
			n = n - di[i] + 1
		if i + 1 in di:
			n = n - 1
	if n > 1:
		print('NO')
	else:
		print('YES')
	t = t - 1


from sys import stdin
x = int(stdin.readline())
for i in range(x):
	n = int(stdin.readline())
	l = list(map(int, stdin.readline().split()))
	l1 = list(set(l))
	if len(l1) == 1:
		print('YES')
	else:
		l1.sort()
		count = 0
		for i in range(len(l1) - 1):
			if abs(l1[i] - l1[i + 1]) <= 1:
				if l1[i] < l1[i + 1]:
					count += 1
				else:
					count += 1
		if count == len(l1) - 1:
			print('YES')
		else:
			print('NO')


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


import sys, math
input = sys.stdin.readline
t = int(input())
for r in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	flag = True
	for i in range(n - 1):
		if abs(l[i] - l[i + 1]) > 1:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	good = True
	for j in range(n - 1):
		if abs(arr[j] - arr[j + 1]) > 1:
			good = False
	if good:
		print('YES')
	else:
		print('NO')


import math
n = int(input())
for i in range(n):
	m = int(input())
	a = [int(i) for i in input().split()]
	a = sorted(a)
	if len(a) == 1:
		print('YES')
	else:
		flag = 0
		for j in range(0, len(a) - 1):
			if abs(a[j] - a[j + 1]) > 1:
				flag = 1
				break
		if flag > 0:
			print('NO')
		else:
			print('YES')


import math

def BubbleSort(tab):
	n = len(tab)
	for i in range(n - 1):
		for j in range(0, n - i - 1):
			if tab[j] > tab[j + 1]:
				(tab[j], tab[j + 1]) = (tab[j + 1], tab[j])
t = int(input())
for i in range(1, t + 1):
	l = int(input())
	a = list(map(int, input().split()))
	j = 0
	b = []
	BubbleSort(a)
	for j in range(0, len(a)):
		try:
			if abs(a[j] - a[j + 1]) <= 1:
				if a[j] < a[j + 1]:
					b.append(a[j])
					j += 1
				elif a[j] > a[j + 1]:
					b.append(a[j + 1])
					j += 1
				else:
					b.append(a[j + 1])
					j += 1
		except:
			pass
	if len(a) - len(b) == 1:
		print('YES')
	else:
		print('NO')


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


t = int(input())
for i in range(t):
	n = int(input())
	s = sorted([int(x) for x in input().split()])
	yes = True
	for j in range(1, n):
		if abs(s[j] - s[j - 1]) > 1:
			yes = False
			break
	print('YES' if yes else 'NO')


first = int(input())
while first > 0:
	first -= 1
	b = int(input())
	c = list(map(int, input().split()))
	c.sort()
	x = 0
	while x < b - 1:
		if c[1] - c[0] > 1:
			print('NO')
			break
		else:
			c.remove(c[0])
			x += 1
	else:
		print('YES')


num = int(input(''))
i = 0
while i < num:
	flag = 1
	length = int(input(''))
	array = input('').split()
	int_arr = []
	for k in array:
		int_arr.append(int(k))
	int_arr.sort()
	for j in range(len(int_arr) - 1):
		if int(int_arr[j + 1]) - int(int_arr[j]) > 1:
			print('NO')
			flag = 0
			break
	if flag == 1:
		print('YES')
	i += 1


for i in range(int(input())):
	n = int(input())
	k = sorted(list(map(int, input().split())))
	yes = 0
	n = 0
	for i in range(len(k) - 1):
		if abs(k[i] - k[i + 1]) <= 1:
			yes += 1
		else:
			n += 1
	if n > 0:
		print('NO')
	else:
		print('YES')


def solve():
	n = int(input())
	numbers = list(map(int, input().split()))
	numbers.sort()
	for i in range(n - 1):
		if numbers[i + 1] - numbers[i] > 1:
			print('NO')
			break
	else:
		print('YES')
for _ in range(int(input())):
	solve()


import math
from collections import deque
import sys
sys.setrecursionlimit(10 ** 4)

def Divisors(n):
	l = []
	i = 2
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
		i = i + 1
	return l

def SieveOfEratosthenes(n):
	l = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			l.append(p)
	return l

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(n)
	return l

def Factors(n):
	result = []
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			if i == n / i:
				result.append(i)
			else:
				result.append(i)
				result.append(n // i)
	result.append(1)
	return result

def maxSubArraySum(a):
	max_so_far = 0
	max_ending_here = 0
	size = len(a)
	for i in range(0, size):
		max_ending_here = max_ending_here + a[i]
		if max_so_far < abs(max_ending_here):
			max_so_far = max_ending_here
	return max_so_far

def longestsubarray(arr, n, k):
	current_count = 0
	max_count = 0
	for i in range(0, n, 1):
		if arr[i] % k != 0:
			current_count += 1
		else:
			current_count = 0
		max_count = max(current_count, max_count)
	return max_count

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


for i in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	a = sorted(ar)
	cnt = 0
	for i in range(n):
		if i == n - 1 or a[i + 1] - a[i] > 1:
			cnt += 1
	if cnt > 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	r = True
	for i in range(1, n):
		r = r and l[i] - l[i - 1] <= 1
	if r:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	N = int(input())
	L = list(map(int, input().split()))
	L.sort()
	c = len(L)
	for i in range(N):
		for j in range(i + 1, N):
			if abs(L[i] - L[j]) <= 1:
				if L[i] <= L[j]:
					c -= 1
					break
				else:
					c -= 1
					break
			else:
				break
	if c <= 1:
		print('YES')
	else:
		print('NO')


import math
T = int(input())
for i in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	d = False
	a.sort()
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			print('NO')
			d = True
			break
	if not d:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	li = list(map(int, input().split()))
	li.sort()
	flag = 0
	if n == 1:
		print('YES')
		continue
	for j in range(0, n - 1):
		if abs(li[j] - li[j + 1]) > 1:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


def func():
	n = int(input())
	a = sorted(list(map(int, input().split())))
	i = 0
	b = a
	while i < n - 1:
		if abs(a[i] - a[i + 1]) > 1:
			return 'NO'
		i += 1
	return 'YES'
for _ in range(int(input())):
	print(func())


def nod(a, b):
	while a != b:
		(a, b) = (max(a, b), min(a, b))
		if a % b == 0:
			a -= (a // b - 1) * b
		else:
			a -= a // b * b
	return a
for t in range(int(input())):
	n = int(input())
	a = list(sorted([int(x) for x in input().split()]))
	res = True
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			res = False
			break
	print('YES' if res else 'NO')


import sys
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	a = True
	l.sort()
	i = 1
	while i < n:
		if abs(l[i - 1] - l[i]) <= 1:
			i = i + 1
		else:
			print('NO')
			a = False
			break
	if a:
		print('YES')


rest = int(input())
while rest:
	np = int(input())
	l = list(map(int, input().split()))
	l.sort()
	io = []
	for i in range(len(l) - 1):
		s = l[i + 1] - l[i]
		io.append(s)
	c = 0
	for i in io:
		if i > 1:
			c = 1
			break
	if c == 0:
		print('YES')
	else:
		print('NO')
	rest -= 1


n = int(input())
while n > 0:
	count = 0
	z = int(input())
	l = input()
	k = [int(n) for n in l.split()]
	k.sort()
	if z > 1:
		for i in range(1, z):
			if abs(k[i] - k[i - 1]) <= 1:
				count += 1
			else:
				break
		if count + 1 == z:
			print('YES')
		else:
			print('NO')
	else:
		print('YES')
	n = n - 1


test = int(input())
for t in range(test):
	n = int(input())
	arr = list(sorted(map(int, input().split())))
	valid = True
	for i in range(1, len(arr)):
		if arr[i] - arr[i - 1] > 1:
			valid = False
			break
	if valid:
		print('YES')
	else:
		print('NO')


from math import *
sInt = lambda : int(input())
mInt = lambda : map(int, input().split())
lInt = lambda : list(map(int, input().split()))
t = sInt()
for _ in range(t):
	n = sInt()
	a = lInt()
	a.sort()
	b = 1
	for i in range(1, n):
		if a[i] - a[i - 1] == 0 or a[i] - a[i - 1] == 1:
			pass
		else:
			b = 0
			break
	if b == 1:
		print('YES')
	else:
		print('NO')


def solve(arr):
	mn = min(arr)
	mx = max(arr)
	for i in range(mn, mx + 1):
		if i not in arr:
			return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	n = input()
	arr = list(map(int, input().split()))
	result = solve(arr)
	print(result)


t = int(input())
while t > 0:
	t -= 1
	n = input()
	n = None
	a = input().split(' ')
	n = 0
	for _ in a:
		a[n] = int(_)
		n += 1
	a.sort()
	n = 0
	check = 0
	while n < len(a) - 1:
		if a[n + 1] - a[n] > 1:
			check += 1
		n += 1
	if check == 0:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	t = int(input())
	arr = []
	str_ = input()
	for j in str_.split(' '):
		arr.append(int(j))
	a = False
	arr = sorted(arr)
	for j in range(t - 1):
		if arr[j + 1] - arr[j] > 1:
			a = True
	if a:
		print('NO')
	else:
		print('YES')


n = int(input())
for ni in range(n):
	run = 1
	m = int(input())
	t = [int(z) for z in input().split()]
	t.sort()
	while run == 1:
		if len(t) == 1:
			run = 0
		else:
			diff = t[1] - t[0]
			if diff >= 0 and diff <= 1:
				del t[0]
			else:
				run = 0
	if len(t) == 1:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

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

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	n = int(input())
	a = sorted(int_array())
	cnt = 0
	for i in range(n - 1):
		if a[i + 1] - a[i] <= 1:
			cnt += 1
	if cnt == n - 1:
		print('YES')
	else:
		print('NO')


t = int(input())
answers = []
for i in range(t):
	ok = 1
	yep = 0
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	if n == 1:
		answers.append('YES')
		yep = 1
	else:
		for j in range(n - 1):
			if abs(a[j] - a[j + 1]) > 1:
				ok = 0
				break
	if ok == 1 and yep == 0:
		answers.append('YES')
	elif ok == 0 and yep == 0:
		answers.append('NO')
for k in range(t):
	print(answers[k])


a = int(input())
for item in range(a):
	b = int(input())
	lst = [int(i) for i in input().split()]
	lst.sort()
	if b == 1:
		print('YES')
	else:
		for u in range(1, b):
			if abs(lst[u - 1] - lst[u]) > 1:
				print('NO')
				break
		else:
			print('YES')


for _ in range(int(input())):
	n = int(input())
	lis = sorted(map(int, input().split()))
	dif = lis[-1] - lis[0]
	if len(set(lis)) == dif + 1:
		print('YES')
	else:
		print('NO')


t = input()

def remove_smallest():
	n = int(input())
	list_num = [int(element) for element in input().split(' ')]
	list_num.sort()
	ans = 'YES'
	for i in range(n - 1):
		if list_num[i] == list_num[i + 1] or list_num[i] == int(list_num[i + 1]) - 1:
			ans = 'YES'
		else:
			ans = 'NO'
			break
	print(ans)
for a in range(int(t)):
	remove_smallest()


import copy
import sys
from os import path
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def solve(n, a):
	b = sorted(a)
	c = list(zip(b, b[1:]))
	for x in c:
		if x[1] - x[0] > 1:
			print('NO')
			return False
	print('YES')
	return True
t = int(input())
for i in range(t):
	n = int(input())
	a = [int(n) for n in input().split()]
	solve(n, a)


x = int(input())
for i in range(x):
	y = int(input())
	l = []
	z = input().split()
	c = 1
	for j in z:
		j = int(j)
		l.append(j)
	l.sort()
	for i in range(y - 1):
		if abs(l[i] - l[i + 1]) <= 1:
			c += 1
	if c == y:
		print('YES')
	else:
		print('NO')


import sys
input = lambda : sys.stdin.readline().strip()
char = [chr(i) for i in range(97, 123)]
CHAR = [chr(i) for i in range(65, 91)]
mp = lambda : list(map(int, input().split()))
INT = lambda : int(input())
rn = lambda : range(INT())
from math import ceil, sqrt, factorial, gcd
for _ in rn():
	n = INT()
	l = sorted(mp())
	ans = 0
	for i in range(1, n):
		if l[i] - l[i - 1] > 1:
			print('NO')
			ans = 1
			break
	if ans == 0:
		print('YES')


test = int(input())
for _ in range(test):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	seta = set(arr)
	if len(seta) == 1:
		print('YES')
	else:
		mini = min(arr)
		maxi = max(arr)
		flag = True
		for i in range(mini, maxi + 1):
			if i not in seta:
				flag = False
				break
		if flag:
			print('YES')
		else:
			print('NO')


def solution(a):
	l = list(set(a))
	l.sort()
	for i in range(len(l) - 1):
		if l[i + 1] - l[i] > 1:
			c = 1
			print('NO')
			return ()
	print('YES')
for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	solution(l)


def gameNEw(a, length):
	a = list(set(a))
	a.sort()
	i = 0
	poss = 0
	while len(a) != 1:
		if abs(a[i] - a[i + 1]) <= 1:
			a.remove(a[i])
		else:
			return 'NO'
	return 'YES'
n = int(input())
ans = []
for i in range(n):
	length = int(input())
	a = list(map(int, input().split()))
	ans.append(gameNEw(a, length))
for i in ans:
	print(i)


from sys import stdin
ip = stdin.readline
for _ in range(int(ip())):
	n = int(ip())
	a = list(map(int, ip().split()))
	a.sort()
	f = True
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			f = False
			break
	print('YES' if f else 'NO')


def p1(n, lst):
	if n == 1:
		return 'YES'
	else:
		a = sorted(lst)
		for i in range(n - 1):
			if a[i + 1] - a[i] > 1:
				return 'NO'
		return 'YES'

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		lst = list(map(int, input().split()))
		print(p1(n, lst))
main()


n = int(input())
for i in range(n):
	n = int(input())
	a = [int(x) for x in input().split()]
	a = list(set(a))
	if max(a) - min(a) + 1 <= len(a):
		print('YES')
	else:
		print('NO')


def solve():
	n = int(input())
	arr = []
	arr = list(map(int, input().split()))
	arr.sort()
	while len(arr) > 1:
		if arr[1] - arr[0] <= 1:
			arr.pop(0)
		else:
			print('NO')
			return
	print('YES')

def main():
	t = int(input())
	while t:
		solve()
		t -= 1
main()


tot = int(input().strip())
while tot > 0:
	n = int(input().strip())
	a = sorted([int(x) for x in input().strip().split(' ')])
	tot -= 1
	ok = True
	for i in range(1, len(a)):
		if abs(a[i] - a[i - 1]) > 1:
			print('NO')
			ok = False
			break
	if ok:
		print('YES')


for _ in range(int(input())):
	r = int(input())
	a = list(map(int, input().strip().split()))
	a.sort()
	diff = 0
	for i in range(r - 1):
		t = abs(a[i] - a[i + 1])
		diff = max(t, diff)
	if diff <= 1:
		print('YES')
	else:
		print('NO')


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


def solution(A):
	A.sort()
	n = len(A)
	ans = n
	for i in range(1, n):
		if A[i] - A[i - 1] <= 1:
			ans -= 1
	return ans == 1
T = int(input())
for _ in range(T):
	n = int(input())
	A = list(map(int, input().split()))
	res = solution(A)
	print('YES' if res else 'NO')


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


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	f = 1
	for i in range(n - 1):
		if abs(arr[i + 1] - arr[i]) > 1:
			print('NO')
			f = 0
			break
	if f:
		print('YES')


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


for _ in ' ' * int(input()):
	a = int(input())
	ans = 0
	b = sorted(map(int, input().split()))
	for i in range(a - 1):
		if b[i + 1] - b[i] > 1:
			ans = 1
			break
	if ans == 0:
		print('YES')
	else:
		print('NO')


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


test_cases = int(input())
for e in range(test_cases):
	n = int(input())
	elements = list(map(int, input().split()))
	elements.sort()
	ans = 'YES'
	for i in range(n - 1):
		if elements[i + 1] - elements[i] > 1:
			ans = 'NO'
			break
	print(ans)


for j in range(int(input())):
	x = int(input())
	A = sorted(list(map(int, input().split())))
	bool = 'YES'
	for i in range(x - 1):
		if A[i + 1] - A[i] > 1:
			bool = 'NO'
	print(bool)


import re
t = int(input())
for i in range(t):
	n = input()
	x = list(map(int, input('').strip().split()))
	x.sort()
	flag = 0
	for j in range(len(x) - 1):
		if abs(x[j] - x[j + 1]) > 1:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


for i in range(int(input())):
	l = int(input())
	a = list(map(int, input().split()))
	sa = sorted(a)
	if any((sa[i + 1] - sa[i] > 1 for i in range(l - 1))):
		print('NO')
	else:
		print('YES')


def remove_smallest(elements):
	if len(elements) == 0:
		return 'NO'
	elif len(elements) == 1:
		return 'YES'
	elements.sort()
	for i in range(len(elements) - 1):
		if abs(elements[i + 1] - elements[i]) <= 1:
			continue
		return 'NO'
	return 'YES'
number_banks = int(input())
for _ in range(number_banks):
	num_elem_in_bank = input()
	bank = [int(el) for el in input().split(' ')]
	print(remove_smallest(bank))


def main():
	test = int(input())
	for _ in range(test):
		n = int(input())
		arr = list(map(int, input().split()))
		arr.sort()
		if len(arr) == 1:
			print('YES')
		else:
			mx = 0
			for i in range(n - 1):
				mx = max(mx, abs(arr[i + 1] - arr[i]))
			if mx > 1:
				print('NO')
			else:
				print('YES')
main()


cases = int(input())
for i in range(cases):
	lenth = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	pri = 'YES'
	for j in range(lenth - 1):
		if lenth == 1:
			pri = 'YES'
		elif arr[j + 1] - arr[j] > 1:
			pri = 'NO'
			break
	print(pri)


for u in range(int(input())):
	n = int(input())
	x = [int(w) for w in input().split()]
	x = sorted(x)
	f = True
	for i in range(1, n):
		if x[i] - x[i - 1] >= 2:
			f = False
			break
	if f:
		print('YES')
	else:
		print('NO')


T = int(input())

def find2(arr):
	arr = sorted(arr)
	for i in range(1, len(arr)):
		if abs(arr[i - 1] - arr[i]) >= 2:
			return False
	return True
for _ in range(T):
	N = int(input())
	board = list(map(int, input().split()))
	if find2(board):
		print('YES')
	else:
		print('NO')


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


import os
from sys import stdin, stdout

def solve(tc):
	n = int(stdin.readline().strip())
	seq = list(map(int, stdin.readline().split()))
	seq = sorted(seq)
	base = seq[0]
	for i in range(1, n):
		if seq[i] - base > 1:
			print('NO')
			return
		base = seq[i]
	print('YES')
tcs = 1
tcs = int(stdin.readline().strip())
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


for i in range(int(input())):
	a = input()
	nums = sorted(map(int, input().split()))
	if {nums[i + 1] - nums[i] for i in range(len(nums) - 1)} - {1, 0} == set():
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	n = int(input())
	lst = input()
	lst = lst.split(' ')
	lst = [int(x) for x in lst]
	lst.sort()
	mx = 0
	x = lst[0]
	for val in lst:
		mx = max(mx, val - x)
		x = val
	if mx > 1:
		print('NO')
	else:
		print('YES')


ans = []

def fun(n, arr):
	arr = sorted(arr)
	if len(arr) == 1:
		ans.append('YES')
	else:
		for i in range(len(arr) - 1):
			if abs(arr[i] - arr[i + 1]) <= 1:
				arr[i] = -1
		if arr.count(-1) == len(arr) - 1:
			ans.append('YES')
		else:
			ans.append('NO')
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	fun(n, arr)
for i in ans:
	print(i)


t = int(input())
for t1 in range(t):
	n = int(input())
	a = [int(n1) for n1 in input().split()]
	a = sorted(a)
	count = 0
	for i in range(len(a) - 1):
		if abs(a[i] - a[i + 1]) <= 1:
			pass
		else:
			count = 1
			break
	if count == 1:
		print('NO')
	else:
		print('YES')


y = int(input())
for i in range(y):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	if n == 1:
		print('YES')
		continue
	a.append(a[-1])
	f = 0
	for j in range(n):
		if a[j + 1] - a[j] > 1:
			f = 1
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


def ans():
	c = 0
	a.sort()
	while len(a) >= 2:
		if abs(a[0] - a[1]) <= 1:
			a.remove(min(a[0], a[1]))
			c += 1
		else:
			return 'NO'
			break
	return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(ans())


for _ in range(int(input())):
	n = int(input())
	arr = [int(a) for a in input().strip().split(' ')]
	arr.sort()
	flag = True
	for i in range(len(arr) - 1):
		if abs(arr[i] - arr[i + 1]) > 1:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	i = 0
	while i < len(a) - 1:
		if a[i + 1] - a[i] <= 1:
			del a[i]
			i = 0
		else:
			i += 1
	if len(a) == 2:
		if a[1] - a[0] <= 1:
			del a[0]
	if len(a) == 1:
		print('YES')
	else:
		print('NO')


import sys
inint = lambda : int(sys.stdin.readline())
inintm = lambda : map(int, sys.stdin.readline().split())
inintl = lambda : list(inintm())
instrm = lambda : map(str, sys.stdin.readline().split())
instrl = lambda : list(instrm())
t = inint()
for _ in range(t):
	n = inint()
	A = inintl()
	A.sort()
	d = A[0]
	for i in range(1, n):
		if abs(d - A[i]) > 1:
			print('NO')
			break
		else:
			d = A[i]
	else:
		print('YES')


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	d = Counter(l)
	d = sorted(list(d.keys()))
	flag = 0
	for i in range(len(d) - 1):
		if d[i + 1] != d[i] + 1:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


from math import *
t = int(input())
while t > 0:
	n = int(input())
	c = n
	lst = [int(i) for i in input().split()]
	lst.sort()
	for i in range(n - 1):
		if abs(lst[i] - lst[i + 1]) <= 1:
			c -= 1
	if c == 1:
		print('YES')
	else:
		print('NO')
	t -= 1


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


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


tests = int(input())
for test in range(tests):
	n = int(input())
	A = list(set(map(int, input().split())))
	A.sort()
	if n == 1:
		print('YES')
	elif n == 1:
		print('NO')
	else:
		ans = True
		for i in range(1, len(A)):
			if abs(A[i] - A[i - 1]) != 1:
				ans = False
		if ans:
			print('YES')
		else:
			print('NO')


for i in range(int(input())):
	m = int(input())
	a = set(map(int, input().split()))
	print('YES' if max(a) - min(a) < len(a) else 'NO')


for i in range(int(input())):
	n = int(input())
	ok = True
	lista = list(map(int, input().split()))
	lista = sorted(lista)
	for j in range(1, n):
		if abs(lista[j] - lista[j - 1]) > 1:
			ok = False
			break
	if ok == True:
		print('YES')
	else:
		print('NO')


def readn():
	return int(input())

def readlist():
	return list(map(int, input().split()))

def readnos():
	return map(int, input().split())
for _ in range(readn()):
	n = int(input())
	a = readlist()
	a.sort()
	f = 1
	for i in range(0, n - 1):
		if a[i + 1] - a[i] > 1:
			f = 0
			break
	if f == 0:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	llist = list(map(int, input().split()))
	llist.sort()
	u = 0
	temp = 0
	while u < n - 1:
		if llist[u + 1] - llist[u] <= 1:
			temp += 1
		u += 1
	if temp == n - 1:
		print('YES')
	else:
		print('NO')


def ans(l, n):
	for i in range(1, n):
		if abs(l[i] - l[i - 1]) > 1:
			return 'NO'
	return 'YES'
t = int(input())
while t:
	n = int(input())
	l = [int(x) for x in input().split()]
	l = sorted(list(set(l)))
	print(ans(l, len(l)))
	t -= 1


def check(N, array):
	for i in range(1, N):
		if array[i] - array[i - 1] > 1:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	N = int(input())
	array = sorted([int(x) for x in input().split()])
	print(check(N, array))


def sid():
	f = 1
	s = 'abcd'
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	f = 0
	sid()
	for i in range(1, n):
		if l[i] - l[i - 1] > 1:
			print('NO')
			f = 1
			break
	if f == 0:
		print('YES')


t = int(input())
for j in range(0, t):
	n = int(input())
	numbers = input()
	numbers = numbers.split(' ')
	numbers = [int(j) for j in numbers]
	numbers.sort()
	if n == 1:
		print('YES')
		continue
	for i in range(0, n - 1):
		if numbers[i] + 1 < numbers[i + 1]:
			print('NO')
			break
		if i == n - 2:
			print('YES')


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	i = 0
	a.sort()
	while i < n - 1:
		if abs(a[i] - a[i + 1]) <= 1:
			if a[i] <= a[i + 1]:
				a.pop(i)
				n -= 1
				i -= 1
			elif a[i + 1] < a[i]:
				a.pop(i + 1)
				n -= 1
				i -= 1
		i += 1
	if len(a) == 1:
		print('YES')
	else:
		print('NO')
	t -= 1


import os
import sys
from io import BytesIO, IOBase

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()

def test():
	n = int(input())
	l = sorted(list(map(int, input().split())))
	if any((abs(l[i] - l[i - 1]) > 1 for i in range(1, n))):
		return 'NO'
	else:
		return 'YES'
t = int(input())
for _ in range(t):
	print(test())


t = int(input())
for i in range(t):
	ok = True
	n = int(input())
	data = sorted(list(map(int, input().split())))
	for j in range(n - 1):
		if data[j + 1] - data[j] > 1:
			ok = False
			break
	print('YES' if ok else 'NO')


import sys
input = sys.stdin.buffer.readline
from collections import deque as que, defaultdict as vector
from bisect import bisect as bsearch
from heapq import *
inin = lambda : int(input())
inar = lambda : list(map(int, input().split()))
INF = float('inf')
testcase = inin()
for Case in range(testcase):
	n = inin()
	a = inar()
	a.sort()
	ans = 'YES'
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			ans = 'NO'
	print(ans)


from queue import Queue

def fast(arr):
	visited = set()
	q = Queue()
	q.put(0)
	while not q.empty():
		i = q.get()
		if i in visited:
			continue
		visited.add(i)
		for j in range(len(arr)):
			if i == j:
				continue
			if abs(arr[i] - arr[j]) <= 1:
				q.put(j)
	return len(visited) == len(arr)

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		arr = list(map(int, input().split()))
		result = fast(arr)
		if result:
			print('YES')
		else:
			print('NO')
main()


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


n = int(input())
for i in range(n):
	leng = int(input())
	nums = list(map(int, input().split()))
	nums.sort()
	mark = 0
	for j in range(len(nums) - 1):
		if abs(nums[j + 1] - nums[j]) > 1:
			mark = 1
			break
	if mark == 0:
		print('YES')
	else:
		print('NO')


import math
import sys
import itertools
import random
import bisect
import heapq
import collections

def lcm(x, y):
	return x * y // math.gcd(x, y)

def hcf(x, y):
	return math.gcd(x, y)

def primes(n):
	prime = [True for _ in range(0, n + 1)]
	res = []
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[p] = False
		p += 1
	for i in range(0, n + 1):
		if prime[i] == True:
			res.append(i)
	return res

def primeFactors(n):
	res = []
	while n % 2 == 0:
		res.append(2)
		n //= 2
	for i in range(3, math.sqrt(n) + 1, 2):
		while n % i == 0:
			res.append(i)
			n //= i
	if n > 2:
		res.append(n)
	return res
for _ in range(0, int(input())):
	n = int(input())
	l = list(map(int, input().strip().split()))
	l.sort()
	flag = 0
	for i in range(0, n - 1):
		if abs(l[i] - l[i + 1]) > 1:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


def binarySearch(sequence, value):
	(low, high) = (0, len(sequence) - 1)
	while low <= high:
		mid = (low + high) // 2
		if sequence[mid] < value:
			low = mid + 1
		elif value < sequence[mid]:
			high = mid - 1
		else:
			return mid
	return -1

def findPair(A, diff):
	li = []
	c = 0
	A.sort()
	i = 0
	while i < len(A):
		while i < len(A) - 1 and A[i] == A[i + 1]:
			i = i + 1
			c = c + 1
		if binarySearch(A, A[i] - diff) >= 0:
			c = c + 1
		i = i + 1
	return c
t = int(input())
while t > 0:
	n = int(input())
	li = [int(ele) for ele in input().split()]
	if len(li) - findPair(li, 1) <= 1:
		print('YES')
	else:
		print('NO')
	t = t - 1


def f(a):
	pass
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	flag = True
	for i in range(len(a) - 1):
		if a[i] == a[i + 1] or a[i] + 1 == a[i + 1] or a[i] == a[i] + 1:
			continue
		else:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))[:n]
	switch = True
	lst.sort()
	for j in range(len(lst) - 1):
		if lst[j + 1] - lst[j] > 1:
			switch = False
			break
	if switch:
		print('YES')
	else:
		print('NO')


test = int(input())

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


def solve(arr):
	if len(arr) == 1:
		return 'YES'
	for i in range(len(arr) - 1):
		if arr[i + 1] - arr[i] > 1:
			return 'NO'
	return 'YES'
try:
	t = int(input())
	for _ in range(t):
		l = int(input())
		arr = list(map(int, input().split()))
		arr.sort()
		print(solve(arr))
except EOFError:
	pass


from sys import stdin
import sys
tt = int(stdin.readline())
for loop in range(tt):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	a.sort()
	flag = True
	for i in range(n - 1):
		if abs(a[i + 1] - a[i]) > 1:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


output = []
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	diff = []
	count = 1
	arr.sort()
	for i in range(1, len(arr)):
		diff.append(abs(arr[i] - arr[i - 1]))
		if diff[-1] > 1:
			count += 1
	if count <= 1:
		output.append('YES')
	else:
		output.append('NO')
for o in output:
	print(o)


def get_answer(a, n):
	if n == 1:
		return 'YES'
	a = sorted(a)
	cum_diff = [a[i] - a[i - 1] for i in range(1, n)]
	for diff in cum_diff:
		if diff > 1:
			return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	a = map(int, input().split())
	print(get_answer(a, n))


t = int(input())
for i in range(t):
	n = int(input())
	a = sorted(list(set(map(int, input().split()))))
	flag = 1
	for j in range(len(a) - 1):
		if a[j + 1] - a[j] > 1:
			print('NO')
			flag = 0
			break
	if flag:
		print('YES')


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


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	new = sorted(arr)
	flag = 0
	count = 0
	for i in range(1, len(new)):
		if len(new) > 1:
			sub = abs(new[i] - new[i - 1])
			if sub > 1:
				flag = 1
				break
			else:
				flag = 0
		else:
			flag = 1
	if flag:
		print('NO')
	else:
		print('YES')


def remove(inputList):
	mySet = set(inputList)
	if len(mySet) == 1:
		print('YES')
	else:
		maxElem = max(mySet)
		if maxElem - 1 in mySet:
			mySet.remove(maxElem)
			remove(mySet)
		else:
			print('NO')

def main():
	t = int(input())
	inputList = []
	for i in range(t):
		numOfInput = int(input())
		myList = [int(x) for x in input().strip().split()]
		inputList.append(myList)
	for l in inputList:
		remove(l)
main()


tom = int(input())
for lol in range(tom):
	fog = 0
	neat = int(input())
	a = [int(neat) for neat in input().split()]
	a.sort()
	for i in range(neat - 1):
		if a[i + 1] - a[i] > 1:
			print('NO')
			fog = 1
			break
		else:
			continue
	if fog == 0:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	s = list(map(int, input().split()))
	s.sort()
	flag = True
	for i in range(0, n - 1):
		if abs(s[i + 1] - s[i]) > 1:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	an = 'YES'
	for j in range(1, n):
		if a[j] - a[j - 1] > 1:
			an = 'NO'
			break
	print(an)


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


t = int(input())
for x in range(t):
	n = int(input())
	nums = set(map(int, input().split()))
	nums = list(nums)
	nums.sort()
	for i in range(len(nums)):
		if i != 0:
			if abs(nums[i] - nums[i - 1]) == 1:
				nums[i - 1] = -1
	if nums.count(-1) == len(nums) - 1:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	f = 0
	for x in range(n - 1):
		if a[x + 1] - a[x] > 1:
			f = 1
			break
	if f:
		print('NO')
	else:
		print('YES')
	t -= 1


t = int(input())
for case in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	if len(set(a)) == 1 or len(a) == 1:
		print('YES')
	else:
		a.sort()
		if any([x - a[i - 1] > 1 for (i, x) in enumerate(a) if i > 0]):
			print('NO')
		else:
			print('YES')


def resolveProblem():
	length = int(input())
	array = list(map(int, input().split()))
	array.sort()
	j = 0
	while j < length - 1:
		if abs(array[j] - array[j + 1]) <= 1:
			if array[j] <= array[j + 1]:
				array.pop(j)
			else:
				array.pop(j + 1)
			j = 0
			length -= 1
		else:
			j += 1
	if length == 1:
		return 'YES'
	else:
		return 'NO'
n = int(input())
for i in range(n):
	print(resolveProblem())


t = int(input())
for t_qr in range(t):
	n = int(input())
	a = list(map(int, input().rstrip().split()))
	a.sort()
	s = []
	for i in range(1, len(a)):
		if a[i] - a[i - 1] <= 1:
			s.append(a[i])
	if len(a) - len(s) == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = input()
	lis = [int(k) for k in str(input()).split()]
	lis.sort()
	a = lis[0]
	aa = 'YES'
	for k in range(len(lis)):
		if lis[k] - a >= 2:
			aa = 'NO'
			break
		a = lis[k]
	print(aa)


n = int(input())
for i in range(n):
	q = int(input())
	a = list(map(int, input().split()))
	a.sort()
	j = 0
	a = list(set(a))
	a.sort()
	q = len(a)
	while q != 1 and j <= q - 2:
		if abs(a[j + 1] - a[j]) == 1:
			a.remove(a[j])
		else:
			j = j + 1
		q = len(a)
	if len(a) == 1:
		print('YES')
	else:
		print('NO')


for test in range(0, int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	key = 1
	for i in range(0, len(arr) - 1):
		if abs(arr[i] - arr[i + 1]) > 1:
			print('NO')
			key = 0
			break
	if key == 1:
		print('YES')


n = int(input())
for i in range(n):
	m = int(input())
	a = list(map(int, input().split(' ')))
	a.sort()
	j = 0
	k = 1
	if len(a) == 1:
		print('YES')
	else:
		while j < len(a):
			if len(a) == 1:
				break
			if k == len(a):
				break
			k = j + 1
			while k <= len(a) - 1:
				if abs(a[j] - a[k]) <= 1:
					if a[j] < a[k]:
						a.remove(a[j])
						break
					else:
						a.remove(a[k])
						break
				else:
					k += 1
		if len(a) == 1:
			print('YES')
		else:
			print('NO')


def remove_smallest():
	t = int(input())
	for iter in range(t):
		n = int(input())
		a_list = list(map(int, input().split()))
		a_list.sort()
		count = 0
		for i in range(n - 1):
			if abs(a_list[i + 1] - a_list[i]) > 1:
				print('NO')
				break
			else:
				count += 1
		if count == n - 1:
			print('YES')
remove_smallest()


from sys import stdin, stdout
from math import gcd, sqrt
from collections import deque
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 0 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
for _ in range(I()):
	n = I()
	a = sorted(R())
	flg = True
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			flg = False
			break
	print('YES' if flg else 'NO')


count = int(input())
for _ in range(count):
	size = int(input())
	data = [int(i) for i in input().split()]
	sortt = sorted(data)
	failed = False
	for i in range(size - 1):
		if sortt[i + 1] - sortt[i] > 1:
			print('NO')
			failed = True
			break
	if not failed:
		print('YES')


n = int(input())

def fun(l):
	l.sort()
	ln = len(l)
	i = 0
	while i < ln:
		if ln > 1:
			j = i + 1
			if j <= ln - 1 and l[j] - l[i] <= 1:
				b = min(l[i], l[j])
				ln -= 1
				l.remove(b)
				i = 0
			else:
				i += 1
		if len(l) == 1:
			return 'YES'
	else:
		return 'NO'
for i in range(n):
	a = int(input())
	a1 = list(map(int, input().split()))
	print(fun(a1))


input_length = int(input())
while input_length != 0:
	arraylength = int(input())
	inp_string = str(input())
	input_length -= 1
	input_array = tuple(inp_string.split())
	input_array = [int(i) for i in input_array]
	input_array = sorted(input_array)
	found = False
	for i in range(0, arraylength - 1):
		if input_array[i + 1] - input_array[i] > 1:
			found = True
			break
	if found:
		print('NO')
	else:
		print('YES')


t = int(input())
index1 = 0
index2 = 1
result = []
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	for j in range(len(l)):
		if len(l) == 1:
			result.append('YES')
			break
		else:
			getAbsolute = abs(l[index1] - l[index2])
			if getAbsolute <= 1:
				l.remove(l[index1])
			else:
				result.append('NO')
				break
	l.clear()
for i in range(len(result)):
	print(result[i], end='\n')


def solve(N, arr):
	if N == 1:
		return 'YES'
	arr.sort()
	for i in range(N - 1):
		currentEle = arr[i]
		nextEle = arr[i + 1]
		if abs(currentEle - nextEle) > 1:
			return 'NO'
	return 'YES'
testCases = int(input())
for case in range(testCases):
	N = int(input())
	arr = list(map(int, input().split()))
	print(solve(N, arr))


from sys import stdin, stdout
import math
cin = stdin.readline
cout = stdout.write
mp = lambda : list(map(int, cin().split()))

def chars():
	s = cin()
	return list(s[:len(s) - 1])

def pl(a):
	for val in a:
		cout(str(val) + ' ')
	cout('\n')
(t,) = mp()
for _ in range(t):
	(n,) = mp()
	a = sorted(mp())
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			cout('NO\n')
			break
	else:
		cout('YES\n')


for _ in range(int(input())):
	num = int(input())
	li = [int(i) for i in input().split()]
	li.sort()
	flag = True
	for i in range(1, len(li)):
		if li[i] - li[i - 1] > 1:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


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


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	diff = []
	for i in range(1, len(a)):
		diff.append(abs(a[i] - a[i - 1]))
	if any((y >= 2 for y in diff)):
		print('NO')
	else:
		print('YES')


from sys import stdin
for _ in range(int(input())):
	n = int(input())
	nums = sorted(list(set(list(map(int, stdin.readline().split())))))
	counter = 0
	flag = False
	for i in range(len(nums) - 1):
		if nums[i + 1] - nums[i] > 1:
			flag = True
			break
	if flag:
		print('NO')
	else:
		print('YES')


T = int(input())
for _ in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	A.sort()
	result = 'YES'
	for i in range(1, N):
		if A[i - 1] + 1 < A[i]:
			result = 'NO'
			break
	print(result)


from collections import deque as d
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	s = 'YES'
	l.sort()
	l = d(l)
	for i in range(n - 1):
		if abs(l[0] - l[1]) <= 1:
			l.popleft()
		else:
			s = 'NO'
			break
	print(s)


for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	(start, end) = (0, len(arr) - 1)
	while start < end:
		if arr[start + 1] - arr[start] <= 1:
			start += 1
		else:
			break
	if end - start >= 1:
		print('NO')
	else:
		print('YES')


from time import time
from random import randint

class Failed(Exception):
	pass

def submit():
	for _ in range(int(input())):
		input()
		numbers = sorted([int(e) for e in input().split()])
		failed = False
		for i in range(1, len(numbers)):
			if numbers[i] - numbers[i - 1] > 1:
				print('NO')
				failed = True
				break
		if failed == False:
			print('YES')

def tryOut():
	start_time = time()
	print(f'Execution time: {time() - start_time}s')
submit()


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a = sorted(a)
	while len(a) > 1:
		if a[1] - a[0] <= 1:
			a.remove(a[0])
		else:
			break
	if len(a) == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c = 0
	r = 1
	if n == 1:
		c = 1
	l.sort()
	for i in range(n):
		for j in range(i + 1, n):
			if l[i] - l[j] == -1 or l[i] - l[j] == 0 or l[i] - l[j] == 1:
				r += 1
				break
	if c == 1:
		print('YES', end='\n')
	elif r == n:
		print('YES', end='\n')
	else:
		print('NO', end='\n')
	r = 1
	c = 0


import sys
t = int(input())
tests = []
for _ in range(t):
	n = int(input())
	a = [int(a) for a in input().split()]
	tests.append((n, a))
for (n, a) in tests:
	a.sort()
	b = True
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			b = False
			break
	print('YES' if b else 'NO')


def smallest(arr):
	if len(arr) == 1:
		return 'YES'
	arr.sort()
	ans = []
	i = 0
	while i < len(arr) - 1:
		if arr[i + 1] - arr[i] <= 1:
			i = i + 1
		else:
			ans.append(arr[i])
			i = i + 1
	if i < len(arr):
		ans.append(arr[i])
	if len(ans) == 1:
		return 'YES'
	return 'NO'
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	print(smallest(arr))


a = int(input())
for i in range(a):
	b = int(input())
	c = list(map(int, input().split(' ')[:b]))
	k = 0
	count = 0
	c.sort()
	for j in range(len(c) - 1):
		for k1 in range(1, len(c)):
			if k1 > j and c[k1] - c[j] <= 1:
				c[j] = 0
				break
		else:
			count = count + 1
			break
		if count == 1:
			break
	if count == 1:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	m = int(input())
	lisstt = sorted(list(map(int, input().split())))
	mcmyes = True
	for number in range(m - 1):
		if lisstt[number + 1] - lisstt[number] > 1:
			mcmyes = False
	if mcmyes:
		print('YES')
	else:
		print('NO')


t = int(input())
for x in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	yes = 'YES'
	no = 'NO'
	a.sort()
	for x in range(n - 1):
		if a[x + 1] - a[x] > 1:
			print(no)
			break
	else:
		print(yes)


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


for tt in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	ans = True
	for i in range(1, n):
		ans = ans and a[i] - a[i - 1] <= 1
	if ans:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	l = int(input())
	arr = sorted(list(map(int, input().split())))
	if l == 1:
		print('YES')
	else:
		s = 0
		for j in range(l - 1):
			if arr[j + 1] - arr[j] <= 1:
				s += 1
		if s == l - 1:
			print('YES')
		else:
			print('NO')


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


for i in range(int(input())):
	input()
	inpu = [int(x) for x in input().split()]
	if len(set(inpu)) == 1 + max(inpu) - min(inpu):
		print('YES')
	else:
		print('NO')


import sys
import math

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

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

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	b = get_array()
	a = sorted(b)
	flag = 0
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


def check(a):
	for i in range(len(a) - 1):
		if abs(a[i] - a[i + 1]) > 1:
			return False
	return True
for i in range(int(input())):
	n = input()
	a = [int(i) for i in input().split()]
	a.sort()
	print('YES' if check(a) else 'NO')


t = int(input())
while t:
	n = int(input())
	a = list(map(lambda x: int(x), input().split()))
	a.sort()
	flag = False
	for i in range(1, len(a)):
		if a[i] - a[i - 1] > 1:
			flag = True
			break
	if not flag:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	result = True
	for i in range(1, len(a)):
		if a[i] - a[i - 1] > 1:
			result = False
			break
	print('YES' if result else 'NO')


import re
test_size = int(input())
lines = list()
no_lines = 2 * test_size
for line in range(no_lines):
	lines.append(input().strip())
n = 0
array_size = list()
arraies = list()
for element in lines:
	if n % 2 != 0:
		num_array = re.findall('[0-9]+', element)
		arraies.append(num_array)
	n += 1
for i in range(test_size):
	m = 0
	array = arraies[i]
	a_size = len(array)
	for ix in range(a_size):
		for j in range(a_size):
			if j < a_size - 1:
				n1 = int(array[j])
				n2 = int(array[j + 1])
				if n1 > n2:
					temp = array[j + 1]
					array[j + 1] = array[j]
					array[j] = temp
	for j in range(a_size):
		if j < a_size - 1 and a_size != 1:
			n1 = int(array[j])
			n2 = int(array[j + 1])
			if abs(n1 - n2) <= 1:
				m += 1
	if m == a_size - 1:
		print('YES')
	else:
		print('NO')


import math, sys, bisect, heapq
from math import *
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])
for _ in range(int(input())):
	N = int(input())
	A = alele()
	if N == 1:
		Y(1)
	else:
		A.sort()
		f = 1
		for (i, j) in zip(A, A[1:]):
			if abs(i - j) > 1:
				f = 0
				break
		Y(f)


def func(arr):
	n = len(arr)
	if n == 1:
		return True
	i = 0
	j = 1
	cnt = 0
	arr.sort()
	while j < n:
		if arr[j] - arr[i] <= 1:
			i += 1
			j += 1
			cnt += 1
		else:
			break
	if cnt == n - 1:
		return True
	return False
t = int(input())
for i in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	if func(arr):
		print('YES')
	else:
		print('NO')


t = int(input())
from math import *
from sys import *
from math import *

def f(arr, k, x):
	count = 0
	for il in arr:
		count += il // x
	if count >= k:
		return True
	else:
		return False
for ip in range(t):
	n = int(input())
	arr = [int(x) for x in input().strip().split()]
	arr = sorted(arr)
	kp = 'YES'
	for il in range(1, n):
		if arr[il] - arr[il - 1] > 1:
			kp = 'NO'
			break
	print(kp)


def main():
	for _ in range(int(input())):
		n = int(input())
		a = [int(x) for x in input().split()]
		a.sort()
		c = 0
		for i in range(n - 1):
			if a[i + 1] - a[i] > 1:
				c = c + 1
		if c > 0:
			print('NO')
		else:
			print('YES')
main()


for _ in [0] * int(input()):
	n = int(input())
	arr = [int(a) for a in input().split()]
	arr.sort()
	ct = arr[0]
	flag = False
	for i in arr:
		if ct == i or ct + 1 == i:
			ct = i
		else:
			flag = True
			break
	if flag == False:
		print('YES')
	else:
		print('NO')


def solve(n, l):
	for i in range(1, n):
		if abs(l[i] - l[i - 1]) > 1:
			return 0
	return 1
t = int(input())
for we in range(t):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	if solve(n, l):
		print('YES')
	else:
		print('NO')


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


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


def check(arr, n):
	for i in range(1, n):
		if abs(ar[i] - ar[i - 1]) > 1:
			return False
	return True
t = int(input())
while t:
	t -= 1
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	if check(ar, n) == True:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = input()
	a = set([int(k) for k in input().split()])
	a = list(a)
	if a:
		while len(a) > 1:
			if min(a) + 1 in a:
				a.remove(min(a))
			else:
				print('NO')
				break
		if len(a) <= 1:
			print('YES')


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


production = True
import sys, math, collections, bisect, itertools, heapq, decimal, random, copy, re

def input(f=0, m=0):
	if m > 0:
		return [input(f) for i in range(m)]
	else:
		l = sys.stdin.readline()[:-1]
		if f >= 10:
			u = False
			f = int(str(f)[-1])
		else:
			u = True
		if f == 0:
			p = [l]
		elif f == 1:
			p = list(map(int, l.split()))
		elif f == 2:
			p = list(map(float, l.split()))
		elif f == 3:
			p = list(l)
		elif f == 4:
			p = list(map(int, list(l)))
		elif f == 5:
			p = l.split()
		return p if u else p[0]

def out(l, f=0, n=True):
	if f == 0:
		p = str(l)
	elif f == 1:
		p = ' '.join(map(str, l))
	elif f == 2:
		p = '\n'.join(map(str, l))
	elif f == 3:
		p = ''.join(map(str, l))
	print(p, end='\n' if n else '')

def log(*args):
	if not production:
		print('$$$', end='')
		print(*args)
enu = enumerate
ter = lambda a, b, c: b if a else c
ceil = lambda a, b: -(-a // b)
flip = lambda a: a + 1 & 1

def mapl(i, f=0):
	if f == 0:
		return list(map(int, i))
	elif f == 1:
		return list(map(str, i))
	elif f == 2:
		return list(map(list, i))

def solve():
	n = input(11)
	a = input(1)
	s = sorted(a)
	for (i, j) in zip(s, s[1:]):
		if abs(i - j) > 1:
			out('NO')
			return
	out('YES')
	return
for i in range(input(11)):
	solve()


t = int(input())
for z in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	if n == 1:
		print('YES')
		continue
	pos = True
	for i in range(n - 1):
		if arr[i + 1] - arr[i] > 1:
			pos = False
			break
	if pos:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	flg = 1
	for j in range(n - 1):
		if a[j + 1] - a[j] <= 1:
			continue
		else:
			flg = 0
	if flg:
		print('YES')
	else:
		print('NO')


import heapq
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	q = []
	for val in arr:
		heapq.heappush(q, val)
	while len(q) != 1:
		tmp1 = heapq.heappop(q)
		tmp2 = heapq.heappop(q)
		if abs(tmp1 - tmp2) >= 2:
			print('NO')
			break
		heapq.heappush(q, tmp2)
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	li.sort()
	booo = True
	for j in range(len(li) - 1):
		if abs(li[j] - li[j + 1]) > 1:
			booo = False
			break
	if booo:
		print('YES')
	else:
		print('NO')


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		A = list(map(int, input().split()))
		A.sort()
		tmp = A[0]
		ok = True
		for a in A:
			if a == tmp or a == tmp + 1:
				tmp = a
			else:
				ok = False
				break
		print('YES') if ok else print('NO')
main()


t = int(input())
for case in range(t):
	n = int(input())
	A = [int(x) for x in input().split(' ')]
	A.sort()
	ans = True
	for i in range(n - 1):
		if A[i + 1] - A[i] >= 2:
			ans = False
	if ans:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ans = 'YES'
	if n == 1:
		print(ans)
		continue
	ar.sort()
	for i in range(1, n):
		if ar[i] - ar[i - 1] > 1:
			ans = 'NO'
			break
	print(ans)


t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))
	L = sorted(a)
	counter = 0
	for i in range(n - 1):
		if L[i] == L[i + 1] or L[i] + 1 == L[i + 1]:
			counter += 1
	if counter == n - 1:
		print('YES')
	else:
		print('NO')
	t -= 1


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


import math
t = int(input())
for i in range(t):
	n = int(input())
	a = input().split(' ')
	for j in range(n):
		a[j] = int(a[j])
	a.sort()
	k = 0
	if n == 1:
		print('YES')
	else:
		for j in range(1, n):
			if a[j] - a[j - 1] > 1:
				k = 1
				break
		if k == 0:
			print('YES')
		else:
			print('NO')


n = int(input())
for i in range(n):
	j = int(input())
	nums = set(list(map(int, input().split())))
	print('YES') if max(nums) - min(nums) < len(nums) else print('NO')


for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	count = 1
	for i in range(1, n):
		if count > 1:
			break
		if abs(a[i - 1] - a[i]) > 1:
			count += 1
	else:
		if count < 2:
			print('YES')
	if count > 1:
		print('NO')


t = int(input())
out = []
for i in range(t):
	n = input()
	a = list(map(int, input().split(' ')))
	a.sort()
	out.append('YES')
	for j in range(len(a) - 1):
		if abs(a[j] - a[j + 1]) > 1:
			out[i] = 'NO'
			break
for i in out:
	print(i)


from sys import stdin, stdout

def input():
	return stdin.readline().strip()

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	flag = True
	for i in range(1, n):
		if abs(a[i] - a[i - 1]) > 1:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')
for t in range(int(input())):
	solve()


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


def solve(n, ar):
	ar.sort()
	flag = False
	for i in range(n - 1):
		if abs(ar[i] - ar[i + 1]) <= 1:
			continue
		else:
			flag = True
			break
	if flag:
		print('NO')
	else:
		print('YES')
t = int(input())
for _ in range(t):
	n = int(input())
	ar = list(map(int, input().split()))
	solve(n, ar)


t = int(input())
for j in range(t):
	n = int(input())
	l = input().split()
	for i in range(n):
		l[i] = int(l[i])
	l.sort()
	fl = []
	for i in range(1, len(l)):
		if l[i] - l[i - 1] <= 1:
			fl.append(l[i])
	for i in fl:
		if i in l:
			l.remove(i)
	if len(l) == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(v) for v in input().split()]
	a.sort()
	j = 0
	f = 0
	while j < n - 1:
		if abs(a[j] - a[j + 1]) <= 1:
			j = j + 1
		else:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	input()
	st = set([int(i) for i in input().split()])
	m = max(st)
	if len(st) == 1:
		print('YES')
	else:
		for i in range(len(st) - 1):
			if i == len(st) - 2 and m - 1 in st:
				print('YES')
			elif m - 1 in st:
				m -= 1
			else:
				print('NO')
				break


for t in range(int(input())):
	n = int(input())
	m = list(sorted([int(y) for y in input().strip().split()]))
	for i in range(1, n):
		if m[i] - m[i - 1] > 1:
			print('NO')
			break
	else:
		print('YES')


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


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	possible = True
	for i in range(n - 1):
		if a[i + 1] - a[i] >= 2:
			possible = False
	if possible:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	bool = True
	arr = sorted(list(map(int, input().split())))
	for i in range(len(arr) - 1):
		if abs(arr[i] - arr[i + 1]) > 1:
			bool = False
			print('NO')
			break
	if bool == True:
		print('YES')


def fun(arr):
	arr.sort()
	for i in range(1, len(arr)):
		if arr[i] - arr[i - 1] > 1:
			return 'NO'
	return 'YES'
t = int(input())
for j in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(fun(arr))


n = int(input())
for i in range(n):
	count = int(input())
	array = [int(j) for j in input().split()]
	array = sorted(array)
	word = 'YES'
	for j in range(count - 1):
		if array[j + 1] - array[j] > 1:
			word = 'NO'
	print(word)


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


t = int(input())
for _ in range(t):
	n = int(input())
	inp = [int(j) for j in input().split()]
	inp.sort()
	cnt = 0
	for i in range(n - 1):
		if abs(inp[i] - inp[i + 1]) <= 1:
			cnt += 1
	if cnt == n - 1:
		print('YES')
	else:
		print('NO')


def solve():
	N = int(input())
	a = list(map(int, input().split()))
	a.sort()
	if any((a[i] + 1 < a[i + 1] for i in range(N - 1))):
		print('NO')
	else:
		print('YES')
	return

def main():
	T = int(input())
	for i in range(T):
		solve()
	return
main()


for _ in range(int(input())):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	(i, j) = (0, 1)
	flag = 0
	while len(l) > 1:
		if l[j] - l[i] <= 1:
			l.remove(l[i])
		else:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


from sys import stdin, stdout
T = int(stdin.readline())
for _ in range(T):
	N = int(stdin.readline())
	arr = [int(x) for x in stdin.readline().split()]
	arr.sort()
	flag = 1
	for i in range(1, N):
		if arr[i] > arr[i - 1] + 1:
			flag = 0
	if flag == 1:
		print('YES')
	else:
		print('NO')


def solve(x):
	for i in range(1, len(x)):
		if abs(x[i] - x[i - 1] > 1):
			return 'NO'
	return 'YES'
cases = int(input())
for i in range(cases):
	size = int(input())
	x = list(map(int, input().split(' ')))
	x = sorted(x)
	print(solve(x))


for _ in range(int(input())):
	lens = int(input())
	arrs = sorted([int(x) for x in input().split()])
	ans = 'YES'
	for i in range(1, len(arrs)):
		if arrs[i] - arrs[i - 1] > 1:
			ans = 'NO'
			break
	print(ans)


tests = int(input())

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


from functools import lru_cache
from sys import stdin, stdout
import sys
from math import *
for __ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	ans = 'YES'
	for i in range(1, n):
		if ar[i] - ar[i - 1] > 1:
			ans = 'NO'
			break
	print(ans)


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


def solve(d, n):
	res = 'YES'
	while len(d) > 1:
		if d[1] - d[0] <= 1:
			d.remove(d[0])
		else:
			res = 'NO'
			break
	print(res)
for _ in range(int(input())):
	n = int(input())
	d = list(map(int, input().split()))
	d.sort()
	solve(d, n)


for ti in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	while 1:
		if len(l) > 1:
			if l[-1] - l[-2] <= 1:
				l.pop()
			else:
				break
		else:
			break
	if len(l) == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
rpta = []
for j in range(t):
	number = int(input())
	main = list(map(int, input().split()))
	main.sort()
	flag = 1
	for i in range(number):
		if i != 0:
			if main[i] - main[i - 1] <= 1:
				pass
			else:
				flag = 0
				break
	if flag == 1:
		rpta.append('YES')
	else:
		rpta.append('NO')
for maiden in rpta:
	print(maiden)


t = int(input())
q = []
for y in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	if len(a) == 1:
		q.append('YES')
	for x in range(1, n):
		if a[x] - a[x - 1] >= 2:
			q.append('NO')
			break
		if x == n - 1:
			q.append('YES')
for x in q:
	print(x)


t = int(input())
for i in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	new = []
	for i in range(len(a) - 1):
		if a[i + 1] - a[i] > 1:
			new.append(0)
		else:
			new.append(1)
	if new.count(0) == 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	s = 'YES'
	for j in range(n - 1):
		if a[j + 1] - a[j] > 1:
			s = 'NO'
	print(s)


def func(a):
	for i in range(len(a) - 1):
		if abs(a[i] - a[i + 1]) > 1:
			return 'NO'
	return 'YES'
q = int(input())
for i in range(q):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(func(a))


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


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


from heapq import *

def smallest_number(nums, n):
	if n == 1:
		return 'YES'
	min_heap = []
	for num in nums:
		heappush(min_heap, num)
	final_list = []
	while len(min_heap) >= 2:
		x1 = heappop(min_heap)
		x2 = min_heap[0]
		if abs(x2 - x1) <= 1:
			pass
		else:
			final_list.append(x1)
		if len(final_list) >= 1:
			return 'NO'
	return 'YES' if len(final_list) + len(min_heap) == 1 else 'NO'
test_cases = int(input())
while test_cases:
	n = int(input())
	input_str = input()
	nums = list(map(int, input_str.split(' ')))
	print(smallest_number(nums, n))
	test_cases -= 1


import math
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 0
	if len(a) == 1:
		print('YES')
	else:
		a.sort()
		for i in range(n - 1):
			if math.fabs(a[i] - a[i + 1]) > 1:
				ans += 1
		if ans == 0:
			print('YES')
		else:
			print('NO')


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


n = int(input())
result = []
for i in range(n):
	leng = int(input())
	lista = list(map(int, input().split()))
	lista.sort()
	matchs = 0
	for j in range(leng - 1):
		if abs(lista[j] - lista[j + 1]) <= 1:
			matchs += 1
	if matchs == leng - 1:
		result.append('YES')
	else:
		result.append('NO')
for i in result:
	print(i)


t = int(input())
while t > 0:
	n = int(input())
	string = input().split(' ')
	arr = [int(i) for i in string]
	already_printed = False
	arr.sort()
	for i in range(n - 1):
		if abs(arr[i] - arr[i + 1]) > 1:
			print('NO')
			already_printed = True
			break
	if already_printed == False:
		print('YES')
	t -= 1


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


t = int(input())
for t in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l = list(set(l))
	l.sort()
	s = 0
	i = 0
	while i < len(l) - 1:
		if abs(l[i] - l[i + 1]) <= 1:
			l.remove(min(l[i], l[i + 1]))
			i = i - 1
		else:
			print('NO')
			c = 1
			break
		i = i + 1
	if len(l) == 1:
		print('YES')


import math
t = int(input())
while t:
	t -= 1
	n = int(input())
	arr = [int(x) for x in input().split()]
	diff = 0
	arr.sort()
	for i in range(n - 1):
		diff = max(diff, abs(arr[i] - arr[i + 1]))
	if diff <= 1:
		print('YES')
	else:
		print('NO')


t = int(input())
A = []
for i in range(t):
	n = int(input())
	s = sorted(list(map(int, input().split())))
	c = 0
	for j in range(n - 1):
		if abs(s[j] - s[j + 1]) <= 1:
			c += 1
	if c == n - 1:
		A.append('YES')
	else:
		A.append('NO')
for i in A:
	print(i)


def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = len(li) - 1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = 0
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans

def sieve_of_eratosthenes(n):
	ans = []
	arr = [1] * (n + 1)
	(arr[0], arr[1], i) = (0, 0, 2)
	while i * i <= n:
		if arr[i] == 1:
			j = i + i
			while j <= n:
				arr[j] = 0
				j += i
		i += 1
	for k in range(n):
		if arr[k] == 1:
			ans.append(k)
	return ans

def nc2(x):
	if x == 1:
		return 0
	else:
		return x * (x - 1) // 2

def kadane(x):
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = max(sum_so_far, current_sum)
	return sum_so_far

def mex(li):
	check = [0] * 1001
	for i in li:
		check[i] += 1
	for i in range(len(check)):
		if check[i] == 0:
			return i

def sumdigits(n):
	ans = 0
	while n != 0:
		ans += n % 10
		n //= 10
	return ans

def product(li):
	ans = 1
	for i in li:
		ans *= i
	return ans

def maxpower(n, k):
	cnt = 0
	while n > 1:
		cnt += 1
		n //= k
	return cnt

def knapsack(li, sumi, s, n, dp):
	if s == sumi // 2:
		return 1
	elif n == 0:
		return 0
	elif dp[n][s] != -1:
		return dp[n][s]
	else:
		if li[n - 1] <= s:
			dp[n][s] = knapsack(li, sumi, s - li[n - 1], n - 1, dp) or knapsack(li, sumi, s, n - 1, dp)
		else:
			dp[n][s] = knapsack(li, sumi, s, n - 1, dp)
		return dp[n][s]

def pref(li):
	pref_sum = [0]
	for i in li:
		pref_sum.append(pref_sum[-1] + i)
	return pref_sum
from math import *
from collections import deque
max_steps = 100005
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	maxi = max(a)
	mini = min(a)
	f = 1
	for i in range(mini, maxi + 1):
		if i not in a:
			f = 0
	print('YES' if f == 1 else 'NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	out = 'YES'
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			out = 'NO'
	print(out)


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


testCases = int(input())
while testCases > 0:
	a = input()
	numList = [int(i) for i in input().split()]
	numSet = list(set(numList))
	numSet.sort()
	f = False
	for i in range(len(numSet) - 1):
		if numSet[i] + 1 is not numSet[i + 1]:
			print('NO')
			f = True
			break
	if not f:
		print('YES')
	testCases -= 1


from collections import Counter, defaultdict as dft

def mp():
	return map(int, input().split())

def ml():
	return list(map(int, input().split()))

def solve():
	n = int(input())
	arr = ml()
	arr = sorted(arr)
	h = []
	for i in arr:
		while h and abs(h[-1] - i) <= 1:
			h.pop()
		h.append(i)
	res = len(h) == 1
	if res:
		print('YES')
	else:
		print('NO')
t = int(input())
for _ in range(t):
	solve()


import sys
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	c = 0
	for i in range(1, len(a)):
		if a[i] - a[i - 1] <= 1:
			c += 1
	if c == len(a) - 1:
		print('YES')
	else:
		print('NO')


def game():
	list1 = []
	output_list = []
	a = input()
	for i in range(2 * int(a)):
		a = input()
		if i % 2 != 0:
			listr = sorted([int(j) for j in a.split(' ')])
			list1.append(listr)
	for i in list1:
		count = 0
		init_var = i[0]
		for j in i:
			if j - init_var > 1:
				output_list.append('NO')
				break
			count += 1
			init_var = j
		if count == len(i):
			output_list.append('YES')
	print('\n'.join(output_list))
game()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	i = 0
	c = 0
	if len(l) == 1:
		print('YES')
		continue
	while i < len(l) - 1:
		if l[i + 1] - l[i] <= 1:
			c += 1
		i += 1
	if c == len(l) - 1:
		print('YES')
	else:
		print('NO')


def solve(nums):
	for i in range(len(nums) - 1):
		if nums[i + 1] - nums[i] > 1:
			return False
	return True
n = int(input())
results = []
for t in range(n):
	n = int(input())
	nums = list(map(int, input().split()))
	nums.sort()
	results.append(solve(nums))
for _ in results:
	if _:
		print('YES')
	else:
		print('NO')


def solution(arr):
	arr.sort()
	for i in range(1, len(arr)):
		val = arr[i] - arr[i - 1]
		if val > 1:
			return False
	return True
for _ in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	cond = solution(arr)
	if cond:
		print('YES')
	else:
		print('NO')


from collections import Counter, defaultdict
from sys import stdin, stdout
input = stdin.readline
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
for _ in range(I()):
	n = I()
	a = LI()
	a.sort()
	flag = 1
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			flag = 0
			break
	if flag:
		print('YES')
	else:
		print('NO')


rounds = int(input())
for i in range(rounds):
	_ = input()
	numbers = list(set([int(token) for token in input().split(' ')]))
	numbers.sort()
	print('YES' if len(numbers) - 1 == numbers[-1] - numbers[0] else 'NO')


for _ in range(int(input())):
	n = int(input())
	a = sorted(map(int, input().split()))
	good = 1
	for i in range(len(a) - 1):
		if a[i + 1] - a[i] >= 2:
			good = 0
	if good:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout, setrecursionlimit
from math import gcd, ceil, sqrt
from collections import Counter
from bisect import bisect_left, bisect_right
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
setrecursionlimit(100000)
mod = 1000000007
tc = ii1()
for _ in range(tc):
	n = ii1()
	arr = sorted(iia())
	for i in range(1, n):
		if arr[i] - arr[i - 1] > 1:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = input()
	arr = list(map(int, input().split()))
	arr.sort()
	isOk = 1
	answers = ['NO', 'YES']
	for i in range(1, len(arr)):
		if arr[i] - arr[i - 1] > 1:
			isOk = 0
	print(answers[isOk])


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


getlist = lambda : list(map(int, input().split()))

def adjacent_diff(ais):
	ais.sort()
	curr = ais[0]
	for ai in ais[1:]:
		if abs(curr - ai) > 1:
			return 'NO'
		curr = ai
	return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	ais = getlist()
	print(adjacent_diff(ais))


from sys import stdin, stdout
for query in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = sorted([int(x) for x in stdin.readline().split()])
	mybool = True
	for x in range(1, n):
		if a[x] > a[x - 1] + 1:
			mybool = False
	if mybool:
		stdout.write('YES\n')
	else:
		stdout.write('NO\n')


n = int(input())
data = []
i = 0
while i < n:
	size = int(input())
	numbers = input().split(' ')
	numbers = list(map(int, numbers))
	data.append(numbers)
	i += 1
i = 0
while i < n:
	if len(data[i]) == 1:
		print('YES')
		i += 1
		continue
	data[i].sort()
	if data[i][1] - data[i][0] >= 2 or data[i][-1] - data[i][-2] >= 2:
		print('NO')
		i += 1
		continue
	can = True
	j = 1
	while j < len(data[i]) - 1:
		if data[i][j] - data[i][j - 1] >= 2 or data[i][j + 1] - data[i][j] >= 2:
			print('NO')
			can = False
			break
		j += 1
	if can:
		print('YES')
	i += 1


T = int(input())
for i in range(T):
	a = int(input())
	b = list(map(int, input().split(' ')))
	b.sort()
	c = 0
	for i in range(a - 1):
		difference = b[i + 1] - b[i]
		if difference > 1:
			c = 1
			break
		else:
			continue
	if c == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	i_liczb = int(input())
	liczby = sorted(list(map(int, input().split())))
	for x in range(i_liczb - 1):
		if abs(liczby[x] - liczby[x + 1]) > 1:
			print('NO')
			break
	else:
		print('YES')


from sys import stdin, stdout
from collections import Counter
from math import ceil
from bisect import bisect_left
from bisect import bisect_right
import math
ai = lambda : list(map(int, stdin.readline().split()))
ei = lambda : map(int, stdin.readline().split())
ip = lambda : int(stdin.readline().strip())
for i in range(ip()):
	n = ip()
	arr = ai()
	arr.sort()
	i = 0
	while n > 1 and abs(arr[i] - arr[i + 1]) <= 1:
		arr.pop(0)
		n -= 1
	if n == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	l = list()
	j = int(input())
	l = sorted(list(set(map(int, input().split()))))
	test = True
	i = 1
	while test == True and i < len(l):
		if l[i] - l[i - 1] > 1:
			test = False
		i += 1
	if test == True:
		print('YES')
	else:
		print('NO')


t = int(input())
for k in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()

	def f():
		for i in range(1, n):
			if a[i] - a[i - 1] > 1:
				return 'NO'
		return 'YES'
	print(f())


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


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


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


t = int(input())
for _t in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l = sorted(l)
	s = 'YES'
	for i in range(1, n):
		if l[i - 1] < l[i] - 1:
			s = 'NO'
	print(s)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(lambda x: int(x), input().split(' ')))
	arr.sort()
	prevlen = None
	newlen = len(arr)
	retval = ''
	while True:
		prevlen = newlen
		j = 0
		while j < len(arr) - 1:
			if arr[j + 1] == arr[j]:
				arr.pop(j + 1)
			elif arr[j + 1] - arr[j] == 1:
				arr.pop(j)
			elif arr[j] - arr[j + 1] == 1:
				arr.pop(j)
			else:
				j += 1
		newlen = len(arr)
		if prevlen == newlen:
			if newlen == 1:
				print('YES')
			else:
				print('NO')
			break


for inp in range(int(input())):
	n = int(input())
	l = sorted(map(int, input().split()))
	print(['YES', 'NO'][any((l[i + 1] - l[i] > 1 for i in range(n - 1)))])


MOD = 1000000007

def i():
	return input()

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))

def mi():
	return map(int, input().split())

def d2b(n):
	return bin(n).replace('0b', '')

def twod(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
t = ii()
while t:
	t -= 1
	n = ii()
	a = li()
	if n == 1:
		print('YES')
		continue
	f = 0
	a.sort()
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			f = 1
			print('NO')
			break
	if f == 0:
		print('YES')


cases = int(input())
for i in range(cases):
	n = int(input())
	l2 = input().split(' ')
	arr = []
	for a in l2:
		arr.append(int(a))
	arr.sort()
	pos = True
	for j in range(len(arr) - 1):
		ele1 = arr[j]
		ele2 = arr[j + 1]
		if ele2 - ele1 >= 2:
			print('NO')
			pos = False
			break
	if pos:
		print('YES')


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


inp = lambda : list(map(int, input().split()))
for i in range(int(input())):
	N = int(input())
	A = inp()
	if N == 1:
		print('YES')
		continue
	A = list(set(A))
	if len(A) == 1:
		print('YES')
		continue
	A.sort()
	p = len(A)
	c = p
	for i in range(p - 1):
		if A[i + 1] - A[i] == 1:
			c = c - 1
		if c == 1:
			print('YES')
			break
	else:
		print('NO')


t = int(input())
for _ in range(t):
	hashtable = {}
	n = int(input())
	a = list(map(int, input().split()))
	for x in a:
		if x not in hashtable:
			hashtable[x] = True
	i = min(a)
	j = max(a)
	ans = True
	for k in range(i, j + 1):
		if k not in hashtable:
			ans = False
	if ans:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	x = int(input())
	lst = list(map(int, input().split()))
	p = sorted(lst)
	count = x
	for j in range(x - 1):
		if abs(p[j + 1] - p[j]) <= 1:
			count -= 1
		else:
			pass
	if count == 1:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	sa = sorted(a)
	an = True
	for i in range(n - 1):
		if sa[i + 1] - sa[i] > 1:
			an = False
			break
	if an == True:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	t -= 1
	lst = []
	n = int(input())
	lst = [int(i) for i in input().split()][:n]
	lst.sort()
	count = 0
	for i in range(1, n):
		if abs(lst[i] - lst[i - 1]) <= 1:
			count += 1
	if count == n - 1:
		print('YES')
	else:
		print('NO')


for test_i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort(reverse=True)
	i = 0
	while i < n - 1 and arr[i] - arr[i + 1] <= 1:
		i += 1
	print('YES' if i == n - 1 else 'NO')


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


testCases = int(input())
j = 0
k = 1
count = 0
newArray = []
for i in range(testCases):
	n = int(input())
	if n > 1:
		array = list(map(int, input().split()))
		newArray = sorted(array)
		while count != n - 1:
			a = newArray[j] - newArray[k]
			if abs(a) < 2:
				newArray.pop(newArray.index(min(newArray[j], newArray[k])))
			else:
				j += 1
				k += 1
			count += 1
		j = 0
		k = 1
		count = 0
		if len(newArray) == 1:
			print('YES')
		else:
			print('NO')
	else:
		dummy = input()
		print('YES')


t = int(input())
ans = []

def solve(arr, n):
	arr.sort()
	for j in range(n - 1):
		if abs(arr[j + 1] - arr[j]) > 1:
			return 'NO'
	return 'YES'
for i in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	if n == 1:
		ans.append('YES')
	else:
		ans.append(solve(arr, n))
for a in ans:
	print(a)


T = int(input())
for _ in range(T):
	N = int(input())
	arr = [int(a) for a in input().split()]
	p = set(arr)
	M = 0
	m = 0
	ans = 'YES'
	for el in arr:
		if not el - 1 in p:
			if m == 0 or m == el - 1:
				m = el - 1
			else:
				ans = 'NO'
		if not el + 1 in p:
			if M == 0 or M == el + 1:
				M = el + 1
			else:
				ans = 'NO'
	print(ans)


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


case = int(input())
for i in range(case):
	n = int(input())
	arr = input().split()
	arr = list(map(int, arr))
	arr = set(arr)
	arr = list(arr)
	arr.sort()
	test = True
	for i in range(len(arr) - 1):
		if arr[i + 1] - arr[i] == 1:
			continue
		else:
			test = False
			break
	if test == True:
		print('YES')
	else:
		print('NO')


def read_array():
	x = []
	x1 = []
	x = input()
	x = x.split(' ')
	for v in x:
		x1.append(int(v))
	return x1

def compute_diferences(x):
	x = sorted(x)
	if x.count(x[0]) == len(x):
		return 'YES'
	for r in range(1, len(x)):
		if x[r] - x[r - 1] >= 2:
			return 'NO'
	return 'YES'
m = int(input())
res = []
for r in range(m):
	z = input()
	x = read_array()
	res.append(compute_diferences(x))
for z in res:
	print(z)


def check():
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	for j in range(n - 1):
		if abs(a[j] - a[j + 1]) > 1:
			return 'NO'
	return 'YES'
k = int(input())
for i in range(k):
	print(check())


t = int(input())
while t != 0:
	n = int(input())
	lst = list(map(int, input().split()))
	if n == 1:
		print('YES')
	else:
		lst.sort()
		count = 0
		for i in range(n - 1):
			if abs(lst[i] - lst[i + 1]) == 1 or abs(lst[i] - lst[i + 1]) == 0:
				count += 1
		if len(lst) - count == 1:
			print('YES')
		else:
			print('NO')
	t -= 1


n = int(input())
while n > 0:
	val = int(input())
	arr = list(map(int, input().split()))
	if len(set(arr)) == 1:
		print('YES')
	else:
		arr = sorted(arr)
		subfix = [arr[0]]
		for x in range(1, len(arr)):
			subfix.append(arr[x] - arr[x - 1])
		ct = 0
		for x in range(1, len(subfix)):
			if subfix[x] == 1 or subfix[x] == 0:
				ct += 1
		if ct == len(arr) - 1:
			print('YES')
		else:
			print('NO')
	n -= 1


t = int(input())
for _ in range(t):
	hash = [0] * 101
	n = int(input())
	a = list(map(lambda x: int(x), input().split()))
	a.sort()
	flag = 0
	for i in range(0, len(a) - 1):
		if a[i + 1] - a[i] > 1:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a = list(set(a))
	if len(a) == 1:
		print('YES')
	else:
		a.sort()
		flag = 0
		while len(a) > 1:
			if a[1] - a[0] == 1:
				a.pop(0)
			else:
				flag = 1
				break
		if flag == 1:
			print('NO')
		else:
			print('YES')


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192
from sys import stderr

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def pow(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def gcd(a, b):
	if a == b:
		return a
	while b > 0:
		(a, b) = (b, a % b)
	return a
from operator import add

def solve():
	n = int(inp())
	ar = lis()
	ar.sort()
	temp = []
	for i in range(1, n):
		temp.append(abs(ar[i] - ar[i - 1]))
	if not temp or max(temp) <= 1:
		print('YES')
	else:
		print('NO')
testcase(int(inp()))


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


def main(args):
	t = int(input())
	for i in range(t):
		n = int(input())
		arr = list(map(int, input().split()))
		arr.sort()
		flag = 0
		for i in range(len(arr) - 1):
			if arr[i + 1] - arr[i] >= 2:
				flag = 1
				break
		if flag == 1:
			print('NO')
		else:
			print('YES')
import sys
sys.exit(main(sys.argv))


def solve(a):
	a.sort()
	count = 0
	for i in range(1, len(a)):
		if a[i] - a[i - 1] >= 2:
			count += 1
	if count >= 1:
		return False
	else:
		return True
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split(' ')]
	if solve(a):
		print('YES')
	else:
		print('NO')


t = int(input())
r = 0
while r < t:
	p = int(input())
	a = input().split()
	i = 0
	while i < p:
		a[i] = int(a[i])
		i = i + 1
	a.sort()
	flag = 1
	i = 0
	while i < p - 1:
		if a[i + 1] - a[i] > 1:
			flag = 0
			break
		i += 1
	if flag == 1:
		print('YES')
	else:
		print('NO')
	r = r + 1


t = int(input())
arr = []
for i in range(t):
	n = int(input())
	a = input().split(' ')
	a = [int(x) for x in a]
	arr.append(a)
for i in range(t):
	mas = sorted(arr[i])
	while True:
		if len(mas) == 1:
			print('YES')
			break
		if mas[1] - mas[0] > 1:
			print('NO')
			break
		del mas[0]


for _ in range(int(input())):
	n = int(input())
	(*arr,) = map(int, input().split())
	arr = set(arr)
	mn = min(arr)
	mx = max(arr)
	for i in range(mn, mx):
		if i not in arr:
			print('NO')
			break
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	c = 0
	for i in range(1, n):
		if abs(l[i] - l[i - 1]) >= 2:
			c = 1
			break
	if c == 0:
		print('YES')
	else:
		print('NO')


from collections import Counter
x = int(input())
for _ in range(x):
	n = int(input())
	eles = [int(num) for num in input().split(' ')]
	map_ = Counter(eles)
	list_ = []
	for key in map_:
		list_.append(int(key))
	list_.sort()
	is_possible = True
	for i in range(len(list_) - 1):
		if abs(list_[i] - list_[i + 1]) > 1:
			is_possible = False
	if is_possible:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	s.sort()
	i = 1
	ans = True
	while i < n:
		ans &= s[i] - s[i - 1] <= 1
		i += 1
	if ans == True:
		print('YES')
	else:
		print('NO')


t = int(input())

def dfs(a):
	for i in range(len(a) - 1):
		if a[i + 1] - a[i] > 1:
			return 'NO'
	return 'YES'
for k in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	a = sorted(arr)
	print(dfs(a))


t = int(input())
while t > 0:
	n = int(input())
	A = list(set(map(int, input().split())))
	A.sort()
	(m, count) = ([], 0)
	for i in range(1, len(A)):
		m.append(A[i] - A[i - 1])
	for j in range(len(m)):
		if m[j] == 1:
			count += 1
	if count == len(m):
		print('YES')
	else:
		print('NO')
	t -= 1


for _ in range(int(input())):
	N = int(input())
	S = list(set(map(int, input().split())))
	S.sort()
	if N == 1:
		print('YES')
	elif all([abs(S[i] - S[i + 1]) == 1 for i in range(len(S) - 1)]):
		print('YES')
	else:
		print('NO')


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


import heapq as hq
from heapq import heappop, heappush
from collections import deque, defaultdict

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())

def subset_sum_count(arr, n, sum):
	dp = [[0 for _ in range(sum + 1)] for _ in range(n + 1)]
	for i in range(n + 1):
		for j in range(sum + 1):
			if j == 0:
				dp[i][j] = 1
			elif arr[i - 1] <= j:
				dp[i][j] = dp[i - 1][j - arr[i - 1]] + dp[i - 1][j]
			else:
				dp[i][j] = dp[i - 1][j]
	return dp[n][sum]

def prefix(a):
	pre = []
	pre.append(a[0])
	for i in range(1, len(a)):
		pre.append(pre[i - 1] + a[i])
	return pre

def binary_search(func, lo, hi, abs_prec=1e-07):
	while abs(hi - lo) > abs_prec:
		mi = lo + (hi - lo) / 2
		if func(mi):
			hi = mi
		else:
			lo = mi
	return (lo + hi) / 2

def ternary_search(func, lo, hi, abs_prec=1e-07):
	while abs(hi - lo) > abs_prec:
		lo_third = lo + (hi - lo) / 3
		hi_third = hi - (hi - lo) / 3
		if func(lo_third) < func(hi_third):
			lo = lo_third
		else:
			hi = hi_third
	return (lo + hi) / 2

def discrete_binary_search(func, lo, hi):
	while lo < hi:
		mi = lo + (hi - lo) // 2
		if func(mi):
			hi = mi
		else:
			lo = mi + 1
	return lo

def discrete_ternary_search(func, lo, hi):
	while lo <= hi:
		lo_third = lo + (hi - lo) // 3
		hi_third = lo + (hi - lo) // 3 + (1 if 0 < hi - lo < 3 else (hi - lo) // 3)
		if func(lo_third) < func(hi_third):
			lo = lo_third + 1
		else:
			hi = hi_third - 1
	return lo
	return -1

def right_rotate(a, s):
	return a[s:] + a[:s]

def dec_to_bin(x):
	return int(bin(x)[2:])

def str_to_integer_list(n):
	a = []
	for i in range(len(n)):
		a.append(int(n[i]))
	return a

def list_to_str(l):
	s = ''
	for i in l:
		s += str(i)
	return s

def dijkstra(s, N, E):
	visited = set()
	dist = {}
	for i in range(1, N + 1):
		dist[i] = 1 << 29
	queue = [(dist[i], i) for i in range(1, N + 1)]
	hq.heappush(queue, (0, s))
	dist[s] = 0
	while queue:
		(d, u) = hq.heappop(queue)
		if u in visited:
			continue
		for t in E[u]:
			(v, r) = t
			if dist[v] > d + r:
				dist[v] = d + r
				hq.heappush(queue, (dist[v], v))
		visited.add(u)
	return dist

def prime_sieve(n):
	flag = n % 6 == 2
	sieve = bytearray((n // 3 + flag >> 3) + 1)
	for i in range(1, int(n ** 0.5) // 3 + 1):
		if not sieve[i >> 3] >> (i & 7) & 1:
			k = 3 * i + 1 | 1
			for j in range(k * k // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
			for j in range(k * (k - 2 * (i & 1) + 4) // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
	return sieve

def prime_list(n):
	res = []
	if n > 1:
		res.append(2)
	if n > 2:
		res.append(3)
	if n > 4:
		sieve = prime_sieve(n + 1)
		res.extend((3 * i + 1 | 1 for i in range(1, (n + 1) // 3 + (n % 6 == 1)) if not sieve[i >> 3] >> (i & 7) & 1))
	return res

def dijkstra(n, graph, start):
	(dist, parents) = ([float('inf')] * n, [-1] * n)
	dist[start] = 0
	queue = [(0, start)]
	while queue:
		(path_len, v) = heappop(queue)
		if path_len == dist[v]:
			for (w, edge_len) in graph[v]:
				if edge_len + path_len < dist[w]:
					(dist[w], parents[w]) = (edge_len + path_len, v)
					heappush(queue, (edge_len + path_len, w))
	return (dist, parents)

def path(start, end, parent):
	path = [end]
	while path[-1] != start:
		path.append(parent[path[-1]])
	path.reverse()
	return path

def bfs(graph, start, goal):
	if start == goal:
		return [start]
	visited = {start}
	queue = deque([(start, [])])
	while queue:
		(current, path) = queue.popleft()
		visited.add(current)
		for neighbor in graph[current]:
			if neighbor == goal:
				return path + [current, neighbor]
			if neighbor in visited:
				continue
			queue.append((neighbor, path + [current]))
			visited.add(neighbor)
	return None
import os
import sys
from io import BytesIO, IOBase

def DecimalToBinary(n):

	def helper(n):
		if n == 0:
			return ''
		else:
			if n % 2 == 1:
				binaryDigit = '1'
			else:
				binaryDigit = '0'
			return helper(n // 2) + binaryDigit
	if n == 0:
		result = '0'
	else:
		result = helper(n)
	return result

def p(board):
	for i in range(8):
		s = ''
		for j in range(8):
			s += board[i][j]
		print(s)

def binaryToDecimal(n):
	return int(n, 2)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def solve(a, b):
	x = DecimalToBinary(a)
	y = DecimalToBinary(b)
	z = x + y
	l = y + x
	r = binaryToDecimal(z) - binaryToDecimal(l)
	return r

def main():
	for _ in range(inp()):
		n = inp()
		a = inlt()
		a.sort()
		flag = 0
		res = []
		if n == 1:
			print('YES')
		else:
			for i in range(n - 1):
				if a[i + 1] - a[i] <= 1:
					res.append(a[i])
			if len(res) == n or len(res) == n - 1:
				print('YES')
			else:
				print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
while t:
	t -= 1
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	st = []
	for i in arr:
		if not st:
			st.append(i)
		elif st[-1] == i:
			st.pop(-1)
			st.append(i)
		elif abs(st[-1] - i) == 1:
			st.pop(-1)
			st.append(i)
		else:
			st.append(i)
	if len(st) == 1:
		print('YES')
		continue
	else:
		print('NO')
		continue


for _ in range(int(input())):
	a = int(input())
	l = [int(i) for i in input().split()]
	l = sorted(l)
	k = 0
	for i in range(1, a, 1):
		if l[i] - l[i - 1] <= 1:
			k += 1
	if a - k != 1:
		print('NO')
	else:
		print('YES')


import sys
input = sys.stdin.readline
(inp, ip) = (lambda : int(input()), lambda : [int(w) for w in input().split()])
for _ in range(inp()):
	n = inp()
	x = ip()
	x.sort()
	ans = 'YES'
	for i in range(1, n):
		if x[i] - x[i - 1] > 1:
			ans = 'NO'
			break
	print(ans)


from collections import Counter
import io, os, math
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
rr = lambda : input()
rri = lambda : int(input())
rrm = lambda : list(map(int, input().split()))
INF = float('inf')

def solve(N, A):
	s = Counter(A)
	if len(s) == 1:
		return 'YES'
	last = max(A)
	for v in sorted(list(s)):
		if v == last:
			break
		if v + 1 not in s:
			return 'NO'
	return 'YES'
t = rri()
for _ in range(t):
	N = rri()
	A = rrm()
	print(solve(N, A))


t = int(input())
for _ in range(0, t):
	n = int(input())
	alist = list(map(int, input().split()))
	alist.sort()
	error = 0
	for k in range(0, len(alist) - 1):
		if alist[k + 1] - alist[k] > 1:
			error = 1
			break
	if error == 1:
		print('NO')
	else:
		print('YES')


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


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


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


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


for _ in range(int(input())):
	n = int(input())
	list1 = list(map(int, input().split()))
	list1.sort()
	flag = 0
	for i in range(1, len(list1)):
		if list1[i] - list1[i - 1] > 1:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


n = int(input())
for i in range(n):
	l = int(input())
	lst = list(map(int, input().strip().split()))
	s = 'YES'
	lst.sort()
	for j in range(0, len(lst) - 1):
		if abs(lst[j] - lst[j + 1]) <= 1:
			continue
		else:
			s = 'NO'
			break
	print(s)


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		if n == 0:
			print('NO')
			continue
		s = list(map(int, input().split()))
		s.sort()
		p = True
		for i in range(len(s) - 1):
			if int(s[i + 1]) - int(s[i]) >= 2:
				p = False
				break
		if p == False:
			print('NO')
		else:
			print('YES')
main()


a = int(input())
for i in range(a):
	m = True
	b = int(input())
	c = [int(s) for s in input().split()]
	c.sort()
	for i in range(1, b):
		if c[i] - c[i - 1] > 1:
			m = False
			break
	if m:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	j = 0
	while j < n - 1 and abs(arr[j] - arr[j + 1]) <= 1:
		j = j + 1
	if j == n - 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	s.sort()
	k = s[-1]
	f = 1
	for i in range(len(s) - 2, -1, -1):
		if abs(k - s[i]) <= 1:
			s.remove(k)
			k = s[i]
		else:
			print('NO')
			f = 0
			break
	if f and len(s) == 1:
		print('YES')


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	if n == 2 and a[1] - a[0] > 1:
		print('NO')
		continue
	for i in range(1, n - 1):
		if abs(a[i] - a[i - 1]) > 1 or abs(a[i] - a[i + 1]) > 1:
			print('NO')
			break
	else:
		print('YES')


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


from math import ceil
for t in range(int(input())):
	n = int(input())
	li = [int(x) for x in input().split()]
	li.sort()
	i = 1
	n = len(li)
	flag = 0
	while i < n:
		if li[i] - li[i - 1] <= 1:
			i += 1
		else:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


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


import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
from collections import defaultdict
con = 10 ** 9 + 7
INF = float('inf')

def getlist():
	return list(map(int, input().split()))

def main():
	T = int(input())
	for _ in range(T):
		N = int(input())
		A = getlist()
		A.sort()
		jud = 'YES'
		for i in range(N - 1):
			if A[i + 1] - A[i] > 1:
				jud = 'NO'
				break
		print(jud)
main()


def solution():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) >= 2:
			print('NO')
			return
	print('YES')
T = int(input())
while T:
	solution()
	T -= 1


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	dif = []
	for i in range(1, len(a)):
		dif.append(a[i] - a[i - 1])
	f = 0
	for i in dif:
		if i != 0 and i != 1:
			f = 1
	if f == 1:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	l = [int(num) for num in input().split()]
	l.sort()
	if n == 1:
		print('YES')
	else:
		for j in range(n - 1):
			if l[j + 1] - l[j] <= 1:
				if j == n - 2:
					print('YES')
			else:
				print('NO')
				break


for _ in range(0, int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	b.sort()
	t = 0
	i = 0
	while len(b) != 1:
		if b[i + 1] - b[i] <= 1:
			b.remove(b[i])
		else:
			t = 1
			break
	if t == 1:
		print('NO')
	else:
		print('YES')


from sys import stdin, stdout
from collections import Counter
input = stdin.readline

def write(n, sep='\n'):
	stdout.write(str(n))
	stdout.write(sep)

def gil():
	return list(map(int, input().split()))
for _t in range(int(input())):
	n = int(input())
	a = gil()
	a = list(set(a))
	a.sort()
	i = 1
	n = len(a)
	c = n
	while len(a) > 1 and i < n:
		if a[i] - a[i - 1] == 1:
			c -= 1
		i += 1
	if c == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	l = []
	ct = 0
	m = int(input())
	arr = list(map(int, input().strip().split()))[:m]
	x = min(arr)
	y = max(arr)
	for j in range(0, y + 1):
		l.append(0)
	for k in arr:
		l[k] += 1
	for j in range(x, y + 1):
		if l[j] == 0:
			ct += 1
			print('NO')
			break
	if ct == 0:
		print('YES')


import sys
import math
from math import *
from collections import defaultdict
import os
from io import BytesIO, IOBase
from collections import deque

def main(d):
	n = int(input())
	arr = list(map(int, input().split()))
	if n == 1:
		print('YES')
	else:
		f = True
		arr.sort()
		mn = arr[0]
		for i in range(1, n):
			if abs(arr[i] - mn) > 1:
				f = False
				break
			mn = max(mn, arr[i])
		if f:
			print('YES')
		else:
			print('NO')
d = defaultdict(lambda : 0)
for i in range(int(input())):
	main(d)


def do():
	k = int(input())
	dat = list(map(int, input().split()))
	c = True
	dat.sort()
	for j in range(1, k):
		if abs(dat[j - 1] - dat[j]) > 1:
			print('NO')
			return
	print('YES')
n = int(input())
for i in range(n):
	do()


T = int(input())
removeSmallArr = []

def removeSmallElem(numArr):
	numArr.sort()
	idx = 0
	while idx < len(numArr) - 1:
		if abs(numArr[idx + 1] - numArr[idx]) <= 1:
			del numArr[idx]
		else:
			idx += 1
	if len(numArr) == 1:
		return 'YES'
	else:
		return 'NO'
for t in range(T):
	size = int(input())
	numArr = list(map(int, input().split()))
	removeSmallArr.append(removeSmallElem(numArr))
for result in removeSmallArr:
	print(result)


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


n = int(input())
kk = []
for i in range(n):
	n = int(input())
	a = [int(x) for x in input().split()]
	f = True
	sort = sorted(a)
	for j in range(n - 1):
		if n == 1:
			break
		if not (sort[j] == sort[j + 1] or sort[j] + 1 == sort[j + 1]):
			f = False
	kk.append(f)
for i in kk:
	if i:
		print('YES')
	else:
		print('NO')


import sys
t = int(sys.stdin.readline().split()[0])
tests = []
k = 0
for line in sys.stdin:
	if k % 2 == 0:
		k += 1
		continue
	test = []
	for word in line.split():
		test.append(int(word))
	tests.append(test)
	k += 1
for test in tests:
	test.sort()
	i = 0
	while i < len(test) - 1:
		if abs(test[i] - test[i + 1]) <= 1:
			test.remove(min(test[i], test[i + 1]))
			continue
		i += 1
	if len(test) == 1:
		print('YES')
	else:
		print('NO')


num_cases = int(input())
for i in range(num_cases):
	num_elements = int(input())
	str = input()
	arr2 = str.split(' ')
	for a in range(num_elements):
		arr2[a] = int(arr2[a])
	arr2.sort()
	truth = True
	for j in range(num_elements - 1):
		if arr2[j + 1] - arr2[j] > 1:
			print('NO')
			truth = False
			break
	if truth:
		print('YES')


def RemoveSmallest():
	for i in range(int(input())):
		x = int(input())
		y = list(map(int, input().split()))
		y.sort()
		counter = 0
		for i in range(x - 1):
			if y[i + 1] - y[i] > 1:
				counter += 1
			if counter > 0:
				print('NO')
				break
		if counter < 1:
			print('YES')
RemoveSmallest()


import sys
input = sys.stdin.readline
t = int(input())
for k in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	a_length = len(a)
	b = []
	for i in range(a_length):
		check = False
		for j in range(i + 1, a_length):
			if abs(a[i] - a[j]) <= 1 and check == False:
				b.append(a[i])
				check = True
	for i in range(len(b)):
		if a.count(b[i]) >= 1:
			a.remove(b[i])
	if len(a) == 1:
		print('YES')
	else:
		print('NO')


fin = list()
t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	s1 = sorted(list(map(int, s.split())))
	for j in range(n - 1):
		if s1[j + 1] - s1[j] > 1:
			fin.append(i)
			break
for i in range(t):
	if i in fin:
		print('NO')
	else:
		print('YES')


for y in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	i = 0
	c = 1
	for x in a:
		i += 1
		if x != a[-1] and c != 0:
			if abs(x - a[i]) <= 1 and abs(x - a[i]) >= 0:
				pass
			else:
				c = 0
	if c == 0:
		print('NO')
	else:
		print('YES')


from sys import stdin, setrecursionlimit, stdout
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin
from heapq import heapify, heappop, heappush, heapreplace, heappushpop
from bisect import bisect_right, bisect_left

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def si():
	return stdin.readline().rstrip()

def lsi():
	return list(si())
mod = 1000000007
res = ['NO', 'YES']
test = test_case = 0
test_case = ii()
while test < test_case:
	test += 1
	n = ii()
	a = li()
	a.sort()
	f = 1
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			f = 0
			break
	print(res[f])


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(d, c) = ({}, 0)
	a.sort()
	for i in a:
		if i - 1 in d:
			del d[i - 1]
			d[i] = 1
		elif i + 1 in d:
			d[i + 1] = 1
		elif d.get(i) == 1:
			pass
		else:
			d[i] = 1
			c += 1
	if n == 0:
		print('NO')
	elif c == 1 or n == 1:
		print('YES')
	else:
		print('NO')


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


test_case = int(input())
for i in range(test_case):
	size = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	check = 0
	for i in range(size - 1):
		if abs(arr[i] - arr[i + 1]) >= 2:
			check += 1
			break
	if check == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	num = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	flag = False
	for i in range(len(arr) - 1):
		if not (arr[i] + 1 == arr[i + 1] or arr[i] == arr[i + 1]):
			flag = True
	if flag == False:
		print('YES')
	else:
		print('NO')


from sys import stdin
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
from collections import deque
(t,) = gil()
for _ in range(t):
	(n,) = gil()
	a = gil()
	a.sort()
	flag = True
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			flag = False
			break
	print('YES' if flag else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	diff_arr = [arr[i + 1] - arr[i] for i in range(n - 1)]
	if any((j for j in diff_arr if j > 1)):
		print('NO')
	else:
		print('YES')


for test in range(int(input())):
	n = int(input())
	l = sorted(map(int, input().split()))
	i = 0
	flag = True
	for i in range(n - 1):
		if abs(l[i] - l[i + 1]) > 1:
			flag = False
			break
	print('YES' if flag else 'NO')


t = int(input())
while t > 0:
	n = int(input())
	seq = list(map(int, input().split()))
	sort_seq = sorted(seq)
	count = n
	for i in range(n - 1):
		if sort_seq[i + 1] - sort_seq[i] <= 1:
			count -= 1
		else:
			break
	if count <= 1:
		print('YES')
	else:
		print('NO')
	t -= 1


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


T = int(input())
for i in range(T):
	n = input()
	l = sorted([int(a) for a in input().split()])
	result = 'YES'
	for i in range(len(l) - 1):
		if abs(l[i] - l[i + 1]) > 1:
			result = 'NO'
	print(result)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(set([int(x) for x in input().split()]))
	arr.sort()
	noCalled = False
	for j in range(1, len(arr)):
		if arr[j] - arr[j - 1] != 1:
			print('NO')
			noCalled = True
			break
	if not noCalled:
		print('YES')


for j in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))[:n]
	s.sort()
	c = 0
	if n == 1:
		print('YES')
	else:
		for i in range(1, n):
			if abs(s[i] - s[i - 1]) <= 1:
				c = 1
			else:
				c = 0
				break
		if c == 1:
			print('YES')
		else:
			print('NO')


def solve(n: int, array: [int]) -> str:
	sorted_no_duplicates = sorted(set(array))
	length = len(sorted_no_duplicates)
	if length == 1:
		return 'YES'
	for i in range(length - 1):
		if sorted_no_duplicates[i + 1] - sorted_no_duplicates[i] > 1:
			return 'NO'
	return 'YES'
T = int(input())
for I in range(T):
	N = int(input())
	s = [int(input_value) for input_value in input().split(' ')]
	print(solve(N, s))


t = int(input())
while t > 0:
	n = int(input())
	arr = list(map(int, input().split(' ')))
	arr.sort()
	ans = True
	for i in range(1, n):
		if arr[i] != arr[i - 1] and arr[i] != arr[i - 1] + 1:
			ans = False
			break
	out = 'YES' if ans else 'NO'
	print(out)
	t -= 1


a = int(input())
for i in range(a):
	s = int(input())
	z = list(map(int, input().split()))
	z.sort()
	flag = 0
	for i in range(1, len(z)):
		if z[i] - z[i - 1] > 1:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	lis = [int(x) for x in input().split()]
	lis.sort()
	flag = 0
	for i in range(n - 1):
		if lis[i] + 1 < lis[i + 1]:
			flag = 1
	if flag == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
ans = []
for i in range(t):
	t = input()
	t = [int(i) for i in input().split()]
	t.sort()
	key = True
	for j in range(len(t) - 1):
		if abs(t[j + 1] - t[j]) > 1:
			key = False
	if key:
		ans.append('YES')
	else:
		ans.append('NO')
print('\n'.join(ans))


t = int(input())
for T in range(t):
	n = input()
	a = set(map(int, input().split()))
	b = set(range(min(a), max(a) + 1))
	print('YES' if a == b else 'NO')


for _ in range(int(input())):
	len_a = int(input())
	a = sorted(list(map(int, input().split())))
	ok = True
	for i in range(1, len_a):
		ok &= a[i] - a[i - 1] <= 1
	print('YES') if ok else print('NO')


from sys import stdin

def input():
	return stdin.readline().rstrip()
for _ in range(int(input())):
	n = int(input())
	s = sorted(list(map(int, input().split())))
	if len(s) == 1:
		print('YES')
	else:
		flag = True
		for i in range(n):
			if s[i] - s[i - 1] > 1:
				flag = False
		if flag:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	l = sorted(l)
	flag = 1
	for i in range(n - 1):
		if l[i + 1] - l[i] >= 2:
			flag = 0
			print('NO')
			break
	if flag == 1:
		print('YES')


t = int(input())
for i in range(t):
	l = int(input())
	ara = list(map(int, input().split()))
	ara.sort()
	flag = False
	for j in range(l - 1):
		if ara[j + 1] - ara[j] > 1:
			print('NO')
			flag = True
			break
	if not flag:
		print('YES')


t = int(input())
for _ in range(t):
	l = int(input())
	a = list(map(int, input().split()))
	a = list(set(a))
	a = sorted(a)
	for i in range(len(a) - 1):
		first = a[i]
		if first + 1 != a[i + 1]:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
j = 0
while j < t:
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	i = 0
	v = 1
	while i < len(a) - 1:
		if a[i + 1] - a[i] > 1:
			break
		v += 1
		i += 1
	if v == len(a):
		print('YES')
	else:
		print('NO')
	j += 1


t = int(input())
for case in range(t):
	n = int(input())
	List = [int(j) for j in input().split(' ')]
	List.sort()
	for i in range(n - 1):
		if abs(List[0] - List[1]) <= 1:
			del List[0]
	if len(List) == 1:
		print('YES')
	else:
		print('NO')


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


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().strip().split()))[:n]
	arr.sort()
	for k in range(n - 1, 0, -1):
		if arr[k] - arr[k - 1] <= 1:
			arr.pop(k)
	if len(arr) == 1:
		print('YES')
	else:
		print('NO')


test_cases = int(input())
for _ in range(test_cases):
	n = int(input())
	a = [int(i) for i in input().split(' ')]
	counter = 0
	a = sorted(a)
	flag = False
	for i in range(1, len(a)):
		if a[i] - a[i - 1] > 1:
			flag = True
			break
	if not flag:
		print('YES')
	else:
		print('NO')


from collections import defaultdict, Counter
from math import log, ceil, floor

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			print('NO')
			return
	print('YES')
t = 1
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for testcase in range(t):
	n = int(input())
	num = list(map(int, input().split(' ')))
	num.sort()
	if len(num) == 1:
		print('YES')
		continue
	x = 1
	while len(num) != 1:
		try:
			if num[x] - 1 == num[x - 1]:
				num.pop(x - 1)
			elif num[x] == num[x - 1]:
				num.pop(x)
			else:
				x += 1
		except IndexError:
			break
	if len(num) == 1:
		print('YES')
	else:
		print('NO')


T = int(input())
for t in range(T):
	N = int(input())
	s = list(map(int, input().split()))
	s.sort()
	c = 0
	res = True
	for n in range(N - 1):
		if s[n + 1] - s[n] > 1:
			res = False
			break
	if res:
		print('YES')
	else:
		print('NO')


from sys import stdin, gettrace
if gettrace():
	inputi = input
else:

	def input():
		return next(stdin)[:-1]

	def inputi():
		return stdin.buffer.readline()

def solve():
	n = int(inputi())
	aa = [int(a) for a in inputi().split()]
	aa.sort()
	if any((a - b > 1 for (a, b) in zip(aa[1:], aa))):
		print('NO')
	else:
		print('YES')

def main():
	t = int(inputi())
	for _ in range(t):
		solve()
main()


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


query = int(input())
for i in range(query):
	size = int(input())
	count = 0
	arr = list(map(int, input().split()))
	arr.sort()
	count = 0
	for j in range(size - 1):
		if arr[j + 1] - arr[j] > 1:
			count += 1
	if count < 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	N = int(input())
	A = list(map(int, input().split()))
	A.sort()
	b = True
	if N == 1:
		print('YES')
		continue
	for x in range(N - 1):
		if A[x + 1] - A[x] > 1:
			b = False
			break
	print('YES' if b else 'NO')


t = int(input())
for i in range(0, t):
	x = int(input())
	li = list(map(int, input().split()))
	li1 = list(set(li))
	li1.sort()
	if len(li1) == 1:
		print('YES')
	else:
		count = 0
		for j in range(0, len(li1) - 1):
			if li1[j + 1] - li1[j] > 1:
				print('NO')
				count = 1
				break
			else:
				continue
		if count == 0:
			print('YES')


from sys import stdin

def solve(arr, n):
	for i in range(n - 1):
		if arr[i + 1] - arr[i] > 1:
			print('NO')
			return
	print('YES')

def solution():
	input = stdin.readline
	t = int(input())
	for i in range(t):
		n = int(input())
		arr = sorted((int(x) for x in input().split()))
		solve(arr, n)
solution()


import sys

def input():
	return sys.stdin.readline().rstrip('\r\n')

def List():
	return list(map(int, input().split()))

def Num():
	return int(input())

def solve():
	n = Num()
	a = List()
	s = set()
	for i in range(n):
		for j in range(i + 1, n):
			if abs(a[i] - a[j]) <= 1:
				if a[i] < a[j]:
					s.add(i)
				else:
					s.add(j)
	if n - len(s) == 1:
		print('YES')
	else:
		print('NO')
for _ in range(Num()):
	solve()


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


import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
input = sys.stdin.readline
mo = 10 ** 9 + 7

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
for _ in range(inin()):
	n = inin()
	l = ain()
	l.sort()
	f = 0
	for i in range(n - 1):
		if l[i + 1] - l[i] > 1:
			f = 1
			break
	if f:
		print('NO')
	else:
		print('YES')


tests = int(input())
for i in range(0, tests):
	longitud = int(input())
	array = list(map(int, input().split()))
	j = 0
	if longitud == 1:
		print('YES')
	array.sort()
	while j < longitud - 1:
		if abs(array[j] - array[j + 1]) <= 1:
			j += 1
		else:
			print('NO')
			break
	if j == longitud - 1 and j != 0:
		print('YES')


t = int(input())
for i in range(t):
	n = input()
	a = [int(_) for _ in input().split()]
	a.sort()
	prv = a[0]
	good = True
	for nxt in a:
		if nxt > prv + 1:
			good = False
			break
		prv = nxt
	print('YES' if good else 'NO')


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	ok = 'YES'
	for x in range(1, n):
		if arr[x] - arr[x - 1] > 1:
			ok = 'NO'
			break
	print(ok)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	maxx = 0
	for i in range(1, n):
		maxx = max(maxx, arr[i] - arr[i - 1])
	if maxx <= 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for j in range(t):
	n = int(input())
	l = sorted([int(k) for k in input().split()])
	l1 = l.copy()
	for i in range(n - 1):
		a = l[i]
		b = l[i + 1]
		if abs(a - b) <= 1:
			l1.remove(a)
	if len(l1) == 1:
		print('YES')
	else:
		print('NO')


t = input()
t = int(t)
while t > 0:
	n = input()
	n = int(n)
	s = input()
	s = [int(x) for x in s.split()]
	if len(s) == 1:
		print('YES')
		t -= 1
		continue
	count = 0
	s = sorted(s)
	for i in range(len(s) - 1):
		if abs(s[i] - s[i + 1]) > 1:
			count += 1
	if count == 0:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
for l in range(t):
	n = int(input())
	a = input().strip().split(' ')
	ar = []
	for i in a:
		if i:
			ar.append(int(i))
	ar.sort()
	c = 0
	for i in range(1, len(ar)):
		if ar[i] - ar[i - 1] > 1:
			c += 1
	if c > 0:
		print('NO')
	else:
		print('YES')


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


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


t = int(input())

def foo(x):
	flag = True
	i = 1
	while i < len(x):
		if x[i] - x[i - 1] > 1:
			flag = False
			break
		else:
			i += 1
	return flag
for i in range(t):
	n = input()
	m = sorted(map(int, input().split()))
	print('YES' if foo(m) else 'NO')


for _ in range(int(input())):
	n = int(input())
	l = [int(p) for p in input().split()]
	l.sort()
	k = 0
	for i in range(1, n):
		if abs(l[i] - l[i - 1]) > 1:
			k = 1
			break
	if k:
		print('NO')
	else:
		print('YES')


def fun(arr):
	a = sorted(arr)
	for i in range(len(a) - 1):
		if abs(a[i] - a[i + 1]) > 1:
			return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(fun(arr))


import math
import sys
t = int(input())
for cs in range(t):
	n = int(input())
	ar = set(map(int, input().split()))
	mn = 1000
	mx = -1
	for x in ar:
		mn = min(mn, x)
		mx = max(mx, x)
	if len(ar) == mx - mn + 1:
		print('YES')
	else:
		print('NO')


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		l = [int(i) for i in input().split()]
		l.sort()
		f = 1
		if n == 1:
			f = 1
		else:
			for i in range(1, n):
				if abs(l[i - 1] - l[i]) > 1:
					f = 0
					break
		if f == 0:
			print('NO')
		else:
			print('YES')
main()


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


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


def solve(lst):
	lst.sort()
	numOffs = 0
	for i in range(len(lst) - 1):
		if lst[i + 1] - lst[i] > 1:
			return 'NO'
	return 'YES'
test_cases = int(input())
for i in range(test_cases):
	n = input()
	lst = list(map(int, input().rstrip().split()))
	res = solve(lst)
	print(res)


t = int(input())
for _ in range(t):
	n = int(input())
	a = {int(x) for x in input().split()}
	a = sorted(a)
	lena = len(a)
	if lena == 1:
		print('YES')
	else:
		for i in range(1, len(a)):
			if a[i] - a[i - 1] != 1:
				print('NO')
				break
		else:
			print('YES')


T = input()
for i in range(int(T)):
	a = int(input())
	l = list()
	str = input()
	l = str.strip().split()
	for i in range(len(l)):
		l[i] = int(l[i])
	sor = sorted(l)
	flag = 0
	for k in range(a - 1):
		ab = abs(sor[k] - sor[k + 1])
		if ab > 1:
			print('NO')
			flag = -1
			break
	if flag == 0:
		print('YES')


a = int(input())
count = 0
for i in range(a):
	b = int(input())
	c = input().split()
	for m in range(len(c) - 1):
		for n in range(m + 1, len(c)):
			if int(c[m]) > int(c[n]):
				(c[m], c[n]) = (c[n], c[m])
	for l in range(b - 1):
		for k in range(l + 1, b):
			if abs(int(c[l]) - int(c[k])) <= 1:
				c[l] = '0'
	for o in range(b):
		if c[o] != '0':
			count += 1
	if count == 1:
		print('YES')
		count = 0
	else:
		print('NO')
		count = 0


number_of_cases = int(input())
for i in range(number_of_cases):
	number_of_elements = int(input())
	numbers = sorted([int(i) for i in input().split()])
	if len(numbers) == 1:
		print('YES')
	else:
		for j in range(len(numbers) - 1):
			if numbers[j + 1] - numbers[j] > 1:
				print('NO')
				break
		else:
			print('YES')


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


t = int(input())
for k in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print('YES')
	else:
		flag = True
		a.sort()
		for i in range(n - 1):
			c = a[i]
			d = a[i + 1]
			if abs(c - d) > 1:
				print('NO')
				flag = False
				break
		if flag:
			print('YES')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	l = 1
	while l < n and a[l] - a[l - 1] <= 1:
		l += 1
	r = n - 2
	while r >= 0 and a[r + 1] - a[r] <= 1:
		r -= 1
	if l == n or r == -1 or l - 1 == r + 1:
		print('YES')
	else:
		print('NO')


import sys
sys.setrecursionlimit(2 ** 20)
I = sys.stdin.readline
pr = sys.stdout.write

def solve():
	I()
	ar = sorted([*map(int, I().split())])
	for (x, y) in zip(ar, ar[1:]):
		if abs(x - y) > 1:
			pr('NO\n')
			return
	pr('YES\n')

def main():
	for _ in range(int(I())):
		solve()
main()


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


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	l = list(a)
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) <= 1:
			c = min(a[i], a[i + 1])
			l.remove(c)
	if len(l) == 1:
		print('YES')
	else:
		print('NO')


from sys import setrecursionlimit
setrecursionlimit(10 ** 9)
import threading
threading.stack_size(67108864)

def solution():
	n = int(input())
	a = sorted(map(int, input().split()))
	deleted = set()
	for i in range(n - 1):
		if a[i + 1] - a[i] <= 1:
			deleted.add(i)
	if len(deleted) == n - 1:
		print('YES')
	else:
		print('NO')
t = int(input())
for _ in range(t):
	solution()


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


a = input()
for x in range(int(a)):
	b = input()
	c = input().split(' ')
	list1 = [int(i) for i in c]
	ans = 0
	list1.sort()
	for i in range(1, len(list1)):
		if list1[i] - list1[i - 1] > 1:
			ans = 1
			break
	if ans == 0:
		print('YES')
	else:
		print('NO')


for _ in range(0, int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	gap = 0
	for i in range(1, len(l)):
		gap = max(gap, l[i] - l[i - 1])
	if gap <= 1:
		print('YES')
	else:
		print('NO')


def check(a):
	if len(a) == 1:
		print('YES')
	else:
		a = list(a)
		for (i, ele) in enumerate(a):
			if i == len(a) - 1:
				break
			if a[i + 1] - a[i] != 1:
				print('NO')
				break
			else:
				continue
		if i == len(a) - 1:
			print('YES')
t = int(input())
for i in range(t):
	b = input()
	a = input().split(' ')
	a = set(map(int, a))
	check(sorted(a))


from itertools import combinations

def returnDiff(combination):
	return abs(combination[1] - combination[0])
t = int(input())
for _ in range(t):
	listofnum = list()
	n = int(input())
	rawInput = input()
	count = 0
	inp = [int(element) for element in rawInput.split(' ')]
	inp.sort()
	for index in range(n):
		if abs(inp[index] - inp[index - 1]) > 1:
			count += 1
	if count > 1:
		print('NO')
	else:
		print('YES')


import math
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
T = inp()
for t in range(T):
	N = inp()
	A = inlt()
	A.sort()
	fl = True
	for n in range(N - 1):
		if abs(A[n] - A[n + 1]) > 1:
			fl = False
			break
	if fl:
		print('YES')
	else:
		print('NO')


def a():
	n = int(input())
	arr = [int(i) for i in input().split()]
	if n == 1:
		return True
	arr.sort()
	maxdiff = 0
	for i in range(1, n):
		if abs(arr[i] - arr[i - 1]) >= 2:
			return False
	return True
t = int(input())
for i in range(t):
	g = a()
	if g:
		print('YES')
	else:
		print('NO')


from functools import reduce
from math import ceil, log2
from operator import add, sub
from collections import Counter

def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	if len(arr) == 0:
		print('NO')
		return
	if len(arr) == 1:
		print('YES')
		return
	arr.sort()
	for i in range(len(arr) - 1):
		if arr[i + 1] - arr[i] < 2:
			continue
		else:
			print('NO')
			return
	print('YES')
	return
t = int(input())
for i in range(t):
	ans = solve()


t = int(input())
for i in range(t):
	n = int(input())
	pole = input().split()
	for j in range(n):
		pole[j] = int(pole[j])
	pole.sort()
	pravda = True
	for j in range(1, n):
		if abs(pole[j] - pole[j - 1]) > 1:
			pravda = False
	if pravda == True:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	mini = min(arr)
	maxa = max(arr)
	set1 = set(list(range(mini, maxa + 1)))
	for i in arr:
		if i in set1:
			set1.remove(i)
	if len(set1) == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for tests in range(t):
	n = input()
	a = [int(x) for x in input().split()]
	a_min = min(a)
	a_max = max(a)
	if a_min == a_max:
		print('YES')
		continue
	gab = False
	for element in range(a_min + 1, a_max):
		if not element in a:
			gab = True
			break
	if gab:
		print('NO')
	else:
		print('YES')


t = int(input())
for cases in range(t):
	n = int(input())
	arr = [int(num) for num in input().split(' ')]
	arr.sort()
	c = 0
	for i in range(n - 1):
		j = i + 1
		if arr[i] + 1 in arr[j:n] or arr[i] in arr[j:n]:
			continue
		else:
			c = 1
			break
	if c == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
while t:
	num = int(input())
	n = input().split()
	l = []
	for x in n:
		l.append(int(x))
	l.sort()
	i = 0
	while i < len(l) - 1:
		if -1 <= l[i] - l[i + 1] <= 1:
			l.pop(i)
		else:
			i += 1
	if len(l) == 1:
		print('YES')
	else:
		print('NO')
	t -= 1


def sum_n(n):
	return n * (n + 1) // 2

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		l = list(map(int, input().split()))
		s = list(set(l))
		s.sort()
		if len(s) == 1:
			print('YES')
		elif sum_n(s[-1]) - sum_n(s[0]) + s[0] == sum(s):
			print('YES')
		else:
			print('NO')
main()


def findDifferenceElements(A):
	for i in range(len(A) - 1):
		if arr[i + 1] - arr[i] <= 1:
			return [i + 1, i]
	return []
T = int(input())
for z in range(T):
	n = int(input())
	arr = sorted(list(map(int, input().split())))
	while True:
		if len(arr) > 1 and findDifferenceElements(arr) == []:
			print('NO')
			break
		elif len(arr) > 1:
			a = findDifferenceElements(arr)
			arr.remove(min(arr[a[0]], arr[a[1]]))
		else:
			print('YES')
			break


def IsPossible(a):
	a.sort()
	prev = a[0]
	for elem in a:
		if elem - prev > 1:
			return 'NO'
		prev = elem
	return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(IsPossible(a))


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


t = int(input())
while t:
	a = []
	flag = 0
	len = int(input())
	a = [int(i) for i in input().split()]
	a = sorted(a)
	l = len - 1
	for i in range(len):
		if a[l] - a[l - 1] > 1:
			flag = -1
			break
		else:
			l = l - 1
	if flag == -1:
		print('NO')
	else:
		print('YES')
	t = t - 1


a = int(input())
for i in range(0, a):
	b = int(input())
	arr = list(map(int, input().split()))
	s = set(arr)
	brr = []
	for i in s:
		brr.append(i)
	if len(brr) - 1 == max(brr) - min(brr):
		print('YES')
	else:
		print('NO')


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


import sys, os
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
input = lambda : sys.stdin.readline().strip()
li = lambda : list(map(int, input().split()))
I = lambda : int(input())
for _ in range(I()):
	n = I()
	l = li()
	l.sort()
	flag = True
	for i in range(n - 1):
		if l[i + 1] - l[i] <= 1:
			continue
		else:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	if n == 1:
		print('YES')
	else:
		l.sort()
		maxm = 0
		for i in range(1, n):
			if l[i] - l[i - 1] > maxm:
				maxm = l[i] - l[i - 1]
		if maxm > 1:
			print('NO')
		else:
			print('YES')


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


for _ in range(int(input())):
	p = 1
	a = int(input())
	b = list((int(x) for x in input().split()))
	b.sort()
	for i in range(a - 1):
		if b[i + 1] - b[i] <= 1:
			pass
		else:
			print('NO')
			p = 0
			break
	if p != 0:
		print('YES')


t = int(input())
res = []
for i in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	if len(arr) == 0:
		res.append('NO')
	elif len(arr) == 1:
		res.append('YES')
	else:
		arr.sort()
		(j, check) = (0, True)
		for k in range(1, len(arr)):
			if arr[k] >= arr[j] + 2:
				res.append('NO')
				check = False
				break
			elif arr[k] == arr[j] + 1:
				j = k
		if check == True:
			res.append('YES')
for i in range(len(res)):
	print(res[i])


def main():
	numCases = int(input())
	nums = []
	for i in range(numCases):
		numElements = int(input())
		elements = input()
		elements = elements.split()
		nums = list(map(int, elements))
		length = len(nums)
		nums.sort()
		idx1 = 0
		idx2 = 1
		while True:
			if idx1 == idx2:
				idx2 += 1
			if length == 1:
				print('YES')
				break
			if idx2 >= len(nums):
				print('NO')
				break
			if abs(nums[idx1] - nums[idx2]) <= 1:
				length -= 1
				idx2 += 1
				continue
			idx1 += 1
main()


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr = sorted(arr)
	found = False
	for i in range(n - 1):
		if arr[i + 1] - arr[i] > 1:
			found = True
			break
	if found:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	test = 0
	i = 0
	while i < len(arr) - 1:
		if arr[i + 1] - arr[i] > 1:
			test = 1
			i = len(arr)
		i = i + 1
	if test == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	temp = 0
	for i in range(1, len(a)):
		if a[i] - a[i - 1] > 1:
			temp = 1
			break
	if temp == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	length = int(input())
	nums = list(map(int, input().split()))
	nums.sort()
	left = 0
	for index in range(1, length):
		if nums[index] - nums[left] > 1:
			print('NO')
			break
		left += 1
	else:
		print('YES')


a = int(input())
i = 0
while i < a:
	b = int(input())
	aa = list(map(int, input().strip().split()))
	aa.sort()
	if len(aa) == 1:
		print('YES')
	else:
		l = 0
		m = 1
		while l < len(aa) - 1:
			cp = 0
			if abs(aa[l] - aa[m]) < 1:
				cp = 1
			elif abs(aa[l] - aa[m]) == 1:
				cp = 1
			else:
				cp = 0
				break
			m += 1
			l += 1
		if cp == 1:
			print('YES')
		else:
			print('NO')
	i += 1


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


t = int(input())
answers = [True] * t
for i in range(t):
	n = int(input())
	x = input().split()
	if n == 1:
		continue
	a = [0] * n
	for j in range(n):
		a[j] = int(x[j])
	a.sort()
	for j in range(n - 1):
		if a[j + 1] - a[j] > 1:
			answers[i] = False
			continue
for i in range(t):
	if answers[i]:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	ar = sorted(list(set(map(int, input().split()))))
	c = 0
	d = 0
	if len(ar) == 1:
		print('YES')
		c = 1
		continue
	else:
		for i in range(len(ar) - 1):
			if abs(ar[i] - ar[i + 1]) == 1 or abs(ar[i] - ar[i + 1] == 0):
				d += 1
			if len(ar) - d == 1:
				print('YES')
				c = 1
				break
		if c == 0:
			print('NO')


n = int(input())
for i in range(n):
	m = int(input())
	s = input().split(' ')
	a = []
	for c in s:
		a.append(int(c))
	a.sort()
	f = False
	for i in range(m - 1):
		if a[i + 1] - a[i] > 1:
			f = True
	if f:
		print('NO')
	else:
		print('YES')


def Fun(a):
	for i in range(len(a) - 1):
		if a[i] != a[i + 1] and a[i] + 1 != a[i + 1]:
			return 'NO'
	return 'YES'
t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(Fun(a))
	t = t - 1


try:
	import sys
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except BaseException:
	pass
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(set(map(int, input().split())))
	print('YES' if len(a) - 1 == max(a) - min(a) else 'NO')


for i in range(int(input())):
	n = int(input())
	a = [int(a) for a in input().split()]
	cnt = 0
	if n == 1:
		print('YES')
	else:
		a.sort()
		for j in range(len(a) - 1):
			if a[j + 1] - a[j] <= 1:
				cnt += 1
		print('YES' if n - cnt == 1 else 'NO')


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	inp = list(map(int, input().split()))
	c = Counter(inp)
	l = list(c.keys())
	l.sort()
	flag = 0
	for i in range(1, len(l)):
		if l[i] - l[i - 1] > 1:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(0, t):
	n = int(input())
	a = input().split()
	for i in range(0, n):
		a[i] = int(a[i])
	a = sorted(a)
	flag = True
	for i in range(1, n):
		if abs(a[i] - a[i - 1]) > 1:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for iteration in range(0, t):
	l = int(input())
	arr = list(map(int, input().rstrip().split()))
	temp = []
	arr.sort()
	for i in range(0, len(arr) - 1):
		if arr[i + 1] - arr[i] <= 1:
			temp.append(arr[i])
	for element in temp:
		if element in arr:
			arr.remove(element)
	if len(arr) == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(s) for s in input().split()]
	a.sort()
	flag = True
	if len(a) > 1:
		for i in range(1, len(a)):
			if a[i] - a[i - 1] > 1:
				print('NO')
				flag = False
				break
		if flag:
			print('YES')
	else:
		print('YES')


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


t = int(input())
for i in range(t):
	n = int(input())
	A = input().split()
	a = list(map(int, A))
	b = len(a)
	if b == 1:
		print('YES')
	else:
		a.sort()
		x = []
		for i in range(n - 1):
			k = abs(a[i] - a[i + 1])
			if k == 1 or k == 0:
				x.append(1)
		if len(x) < n - 1:
			print('NO')
		else:
			print('YES')


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


from sys import stdin

def get_int():
	return int(stdin.readline())

def get_str():
	return stdin.readline().strip()

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

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

def get_array2d(row):
	return [list(map(int, stdin.readline().strip().split())) for _ in range(row)]
T = get_int()
for _ in range(T):
	N = get_int()
	A = get_array()
	A.sort()
	flag = 1
	for i in range(N - 1):
		if A[i + 1] - A[i] > 1:
			flag = 0
			break
	if flag:
		print('YES')
	else:
		print('NO')


import sys, math
from collections import deque, defaultdict
import operator as op
from functools import reduce
I = sys.stdin.readline

def ii():
	return int(I().strip())

def li():
	return list(map(int, I().strip().split()))

def mi():
	return map(int, I().strip().split())

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def main():
	for _ in range(ii()):
		n = ii()
		arr = sorted(li())
		if n == 1:
			print('YES')
		else:
			flag = 0
			for i in range(n - 1):
				if arr[i + 1] - arr[i] > 1:
					flag = 1
					break
			if flag == 0:
				print('YES')
			else:
				print('NO')
main()


import sys, io, os, time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect, math, heapq
alphabet = 'abcdefghijklmnopqrstuvwxyz'
input = sys.stdin.readline
for ii in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort(reverse=True)
	f = 1
	for i in range(n - 1):
		if abs(arr[i] - arr[i + 1]) > 1:
			f = 0
			break
	if f:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	flag = True
	for j in range(n - 1):
		if arr[j + 1] - arr[j] > 1:
			flag = False
			break
	if flag == True:
		print('YES')
	else:
		print('NO')


t = int(input())
for p in range(t):
	n = int(input())
	flag = 0
	ar = [int(i) for i in input().split()]
	ar = sorted(ar)
	for i in range(0, n - 1):
		if ar[i + 1] - ar[i] >= 2:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


for j in range(int(input())):
	n = int(input())
	a = input().split(' ')
	b = []
	for k in a:
		b.append(int(k))
	b.sort()
	if n == 1:
		print('YES')
	else:
		c = []
		for i in range(n - 1):
			c.append(b[i + 1] - b[i])
		if max(c) > 1:
			print('NO')
		else:
			print('YES')


def c(n, a):
	if n == 0:
		return 'YES'
	elif n == 1 or len(set(a)) == 1:
		return 'YES'
	else:
		r = max(a)
		w = min(a)
		f = [*range(w, r)]
		for i in f:
			if i not in a:
				return 'NO'
		return 'YES'
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(c(n, a))


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	f = 0
	for i in range(n - 1):
		if abs(l[i] - l[i + 1]) > 1:
			f = 1
	if f == 1:
		print('NO')
	else:
		print('YES')


def get_val(arr):
	num = len(arr)
	if num == 1:
		return 'YES'
	for j in range(num):
		for k in range(num - j - 1):
			if arr[k] > arr[k + 1]:
				temp = arr[k]
				arr[k] = arr[k + 1]
				arr[k + 1] = temp
	for j in range(num - 1):
		if arr[j + 1] - arr[j] > 1:
			return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().strip().split()))[:n]
	strarr = get_val(a)
	print(strarr)


test = int(input())
from collections import defaultdict
for i in range(test):
	n = int(input())
	arr = [int(i) for i in input().split()]
	if n == 1:
		print('YES')
	else:
		max_ = max(arr)
		min_ = min(arr)
		cnt = defaultdict(int)
		for i in range(n):
			cnt[arr[i]] = 1
		if all((cnt[j] == 1 for j in range(min_, max_ + 1))):
			print('YES')
		else:
			print('NO')


for z in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ok = True
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			ok = False
			break
	if ok:
		print('YES')
	else:
		print('NO')


i = int(input())
for _ in range(i):
	_ = input()
	yes = True
	tl = list(map(int, input().split()))
	tl.sort()
	for _ in range(len(tl) - 1):
		if abs(tl[_] - tl[_ + 1]) > 1:
			yes = False
	if yes:
		print('YES')
	else:
		print('NO')


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


t = int(input())
answers = []
for a in range(t):
	n = int(input())
	line = [int(i) for i in input().split()]
	line.sort()
	answer = True
	for b in range(1, len(line)):
		if line[b] - line[b - 1] > 1:
			answer = False
			break
	if answer:
		answers.append('YES')
	else:
		answers.append('NO')
for b in answers:
	print(b)


t = int(input())
arrLst = []
nLst = []
for z in range(t):
	ni = int(input())
	nLst.append(ni)
	arr = []
	arr = input().split()
	for x in range(len(arr)):
		arr[x] = int(arr[x])
	arrLst.append(arr)
for i in range(len(arrLst)):
	if len(arrLst[i]) != 1:
		for j in range(len(arrLst[i])):
			j_max = max(arrLst[i])
			arrLst[i].remove(j_max)
			j_max_2 = max(arrLst[i])
			if abs(j_max - j_max_2) <= 1:
				if len(arrLst[i]) == 1:
					print('YES')
					break
			else:
				print('NO')
				break
	else:
		print('YES')


nn = int(input())
for k in range(nn):
	n = int(input())
	m = list(map(int, input().split()))
	m.sort()
	yes = True
	for i in range(1, n):
		if m[i] - m[i - 1] > 1:
			yes = False
			break
	if yes:
		print('YES')
	else:
		print('NO')


inp = int(input())
for num in range(inp):
	counter = 0
	inp1 = int(input())
	l = sorted(list(map(int, input().split())))
	if l[0] == l[-1]:
		print('YES')
		continue
	else:
		for i in range(inp1):
			for j in range(i + 1, inp1):
				if abs(l[i] - l[j]) <= 1:
					if l[i] < l[j] or l[i] == l[j]:
						l[i] = 0
						counter += 1
						break
					else:
						print(l[i])
						print(l[j])
						l[j] = 0
						counter += 1
						break
	if counter == len(l) - 1:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	if n == 1:
		print('YES')
		continue
	ok = 1
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) > 1:
			ok = 0
	if ok:
		print('YES')
	else:
		print('NO')


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


import math
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlst():
	return list(map(int, input().split()))

def instr():
	s = input()
	return list(s[:len(s) - 1])

def invar():
	return map(int, input().split())

def pba(n, a):
	flag = [1] * n
	a.sort()
	temp = a[0]
	index = 0
	for i in range(1, n):
		if a[i] - temp <= 1:
			flag[index] = 0
			temp = a[i]
			index = i
	return 'YES' if flag.count(1) == 1 else 'NO'
for _ in range(inp()):
	n = inp()
	a = inlst()
	print(pba(n, a))


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


N = int(input())
for i in range(N):
	length = int(input())
	current = list(map(int, input().strip().split(' ')))
	current.sort()
	t = 0
	for i in range(length - 1):
		if current[i + 1] - current[i] > 1:
			t = 1
	if t == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	k = 0
	A = sorted(list(map(int, input().split())))
	for i in range(1, n):
		if A[i] - A[i - 1] <= 1:
			continue
		else:
			k = 1
			break
	if k:
		print('NO')
	else:
		print('YES')


t = int(input())
for z in range(t):
	n = int(input())
	p = input()
	p = p.split(' ')
	p = map(int, p)
	p = sorted(p)
	if n == 1:
		print('YES')
	else:
		for _ in range(n - 1):
			if p[_ + 1] - p[_] > 1:
				print('NO')
				break
			if _ == n - 2:
				print('YES')


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


def f(li):
	s = set()
	for i in range(1, len(li)):
		s.add(li[i] - li[i - 1])
	if len(s) > 1 or (len(s) == 1 and (not 1 in s)):
		return False
	else:
		return True
for _ in range(int(input())):
	answer = 0
	n = int(input())
	listak = list(set(map(int, input().split())))
	listak.sort()
	if f(listak):
		print('YES')
	else:
		print('NO')


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


t = int(input())
for i in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	one = True
	for j in range(n - 1):
		if a[j + 1] - a[j] > 1:
			one = False
	if one:
		print('YES')
	else:
		print('NO')


import sys
import math
from sys import stdin, stdout

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

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

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

def main():
	for t in range(int(input())):
		n = int(input())
		l = get_list()
		l.sort()
		c = 0
		for i in range(1, n):
			if l[i] - l[i - 1] <= 1:
				c += 1
		if c == n - 1:
			print('YES')
		else:
			print('NO')
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


times = int(input())
for i in range(times):
	nothing = input()
	need = set(map(int, input().split()))
	if max(need) - min(need) >= len(need):
		print('NO')
	else:
		print('YES')


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


t = int(input())
for i in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()][:n]
	if len(arr) == 1 or arr.count(arr[0]) == len(arr):
		print('YES')
	else:
		arr.sort()
		ok = 1
		for count in range(1, len(arr)):
			if abs(arr[count] - arr[count - 1]) > 1:
				ok = 0
				break
		if ok == 1:
			print('YES')
		else:
			print('NO')


from collections import defaultdict
import sys, math
f = None
try:
	f = open('q1.input', 'r')
except IOError:
	f = sys.stdin
if 'xrange' in dir(__builtins__):
	range = xrange

def print_case_iterable(case_num, iterable):
	print('Case #{}: {}'.format(case_num, ' '.join(map(str, iterable))))

def print_case_number(case_num, iterable):
	print('Case #{}: {}'.format(case_num, iterable))

def print_iterable(A):
	print(' '.join(A))

def read_int():
	return int(f.readline().strip())

def read_int_array():
	return [int(x) for x in f.readline().strip().split(' ')]

def rns():
	a = [x for x in f.readline().split(' ')]
	return (int(a[0]), a[1].strip())

def read_string():
	return list(f.readline().strip())

def ri():
	return int(f.readline().strip())

def ria():
	return [int(x) for x in f.readline().strip().split(' ')]

def rns():
	a = [x for x in f.readline().split(' ')]
	return (int(a[0]), a[1].strip())

def rs():
	return list(f.readline().strip())

def bi(x):
	return bin(x)[2:]
from collections import deque
import math
NUMBER = 10 ** 9 + 7

def factorial(n):
	M = NUMBER
	f = 1
	for i in range(1, n + 1):
		f = f * i % M
	return f

def mult(a, b):
	return a * b % NUMBER

def minus(a, b):
	return (a - b) % NUMBER

def plus(a, b):
	return (a + b) % NUMBER

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, y, x) = egcd(b % a, a)
		return (g, x - b // a * y, y)

def modinv(a):
	m = NUMBER
	(g, x, y) = egcd(a, m)
	if g != 1:
		raise Exception('modular inverse does not exist')
	else:
		return x % m

def choose(n, k):
	if n < k:
		assert false
	return mult(factorial(n), modinv(mult(factorial(k), factorial(n - k)))) % NUMBER
from collections import deque, defaultdict
import heapq
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc

def dfs(g, timeIn, timeOut, depths, parents):
	cnt = 0
	stack = [[1, 0, 0, 0]]
	while stack:
		(v, neig_i, parent, depth) = stack[-1]
		parents[v] = parent
		depths[v] = depth
		if neig_i == 0:
			timeIn[v] = cnt
			cnt += 1
		while neig_i < len(g[v]):
			u = g[v][neig_i]
			if u == parent:
				neig_i += 1
				continue
			stack[-1][1] = neig_i + 1
			stack.append([u, 0, v, depth + 1])
			break
		if neig_i == len(g[v]):
			stack.pop()
			timeOut[v] = cnt
			cnt += 1
cnt = 0

@bootstrap
def dfs(v, adj, timeIn, timeOut, depths, parents, parent=0, depth=0):
	global cnt
	parents[v] = parent
	depths[v] = depth
	timeIn[v] = cnt
	cnt += 1
	for u in adj[v]:
		if u == parent:
			continue
		yield dfs(u, adj, timeIn, timeOut, depths, parents, v, depth + 1)
	timeOut[v] = cnt
	cnt += 1
	yield

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

def lcm(a, b):
	return a * b / gcd(a, b)

def get_num_2_5(n):
	twos = 0
	fives = 0
	while n > 0 and n % 2 == 0:
		n //= 2
		twos += 1
	while n > 0 and n % 5 == 0:
		n //= 5
		fives += 1
	return (twos, fives)

def shift(a, i, num):
	for _ in range(num):
		(a[i], a[i + 1], a[i + 2]) = (a[i + 2], a[i], a[i + 1])

def equal(x, y):
	return abs(x - y) <= 1e-09

def getAngle(a, b, c):
	ang = math.degrees(math.atan2(c[1] - b[1], c[0] - b[0]) - math.atan2(a[1] - b[1], a[0] - b[0]))
	return ang + 360 if ang < 0 else ang

def getLength(a, b):
	return math.sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)
from heapq import heapify, heappush, heappop

def bfs(adj):
	s = set()
	d = defaultdict(set)
	q = deque([])
	s.add(0)
	d[0].add(0)
	q.append((0, 0))
	while len(q) > 0:
		(v, depth) = q.popleft()
		for u in adj[v]:
			if u not in s:
				s.add(u)
				d[depth + 1].add(u)
				q.append((u, depth + 1))
	return d

def isSubsetSum(arr, n, summ):
	subarr = [[False for i in range(summ + 1)] for i in range(n + 1)]
	for i in range(n + 1):
		subarr[i][0] = True
	for i in range(1, summ + 1):
		subarr[0][i] = False
	for i in range(1, n + 1):
		for j in range(1, summ + 1):
			if j < arr[i - 1]:
				subarr[i][j] = subarr[i - 1][j]
			if j >= arr[i - 1]:
				subarr[i][j] = subarr[i - 1][j] or subarr[i - 1][j - arr[i - 1]]
	return subarr[n][summ]

def bfs(v, adj, onpath):
	s = set()
	d = defaultdict(set)
	q = deque([])
	s.add(0)
	d[0].add(0)
	q.append((0, 0))
	while len(q) > 0:
		(v, depth) = q.popleft()
		for u in adj[v]:
			if u not in s:
				s.add(u)
				d[depth + 1].add(u)
				q.append((u, depth + 1))
	return d

def solution(a, n):
	a.sort()
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			return 'NO'
	return 'YES'

def main():
	T = 1
	T = ri()
	for i in range(T):
		n = ri()
		a = ria()
		x = solution(a, n)
		if 'xrange' not in dir(__builtins__):
			print(x)
		else:
			(print >> output, str(x))
	if 'xrange' in dir(__builtins__):
		print(output.getvalue())
		output.close()
if 'xrange' in dir(__builtins__):
	import cStringIO
	output = cStringIO.StringIO()
main()


def main():
	_ = int(input())
	s = list(map(int, input().split()))
	s = list(dict.fromkeys(s))
	s.sort()
	if len(s) == 1:
		return 'YES'
	ss = list(range(s[0], s[len(s) - 1] + 1))
	if s == ss:
		return 'YES'
	else:
		return 'NO'
for i in range(int(input())):
	print(main())


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	arr = list(set(arr))
	arr.sort()
	if len(arr) < 2:
		print('YES')
	else:
		flag = 0
		for index in range(0, len(arr) - 1):
			if arr[index + 1] - arr[index] > 1:
				print('NO')
				flag = 1
				break
		if flag == 0:
			print('YES')


def solve():
	n = int(input().strip())
	arr = [int(i) for i in input().rstrip().split()]
	sorted(arr)
	ans = True
	for i in range(min(arr), max(arr)):
		if i not in arr:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')

def main():
	tc = int(input().strip())
	for case in range(tc):
		solve()
main()


t = int(input())
while t:
	n = int(input())
	nums = list(map(int, input().split()))
	nums.sort()
	flag = 0
	for x in range(n - 1):
		if abs(nums[x] - nums[x + 1]) >= 2:
			flag = 1
	if flag:
		print('NO')
	else:
		print('YES')
	t -= 1


TestCaseNo = int(input())
for x in range(TestCaseNo):
	Stringlen = int(input())
	TestCase = sorted([int(z) for z in input().split()])
	if Stringlen == 1:
		print('YES')
	else:
		for y in range(Stringlen - 1):
			if TestCase[y + 1] - TestCase[y] > 1:
				No = True
				break
			else:
				No = False
		if not No:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().strip().split()))
	li.sort()
	flag = 0
	for i in range(1, n):
		if li[i] - li[i - 1] > 1:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


t = int(input())
while t:
	t -= 1
	n = int(input())
	nums = sorted(map(int, input().split()))
	yes = True
	for i in range(1, n):
		if nums[i] - nums[i - 1] > 1:
			yes = False
			break
	if yes:
		print('YES')
	else:
		print('NO')


from collections import defaultdict as dd
import math
import sys
import string
input = sys.stdin.readline

def nn():
	return int(input())

def li():
	return list(input())

def mi():
	return map(int, input().split())

def lm():
	return list(map(int, input().split()))

def solve():
	n = nn()
	nums = lm()
	nums.sort()
	for i in range(n - 1):
		if nums[i + 1] - nums[i] > 1:
			print('NO')
			return
	print('YES')
q = nn()
for _ in range(q):
	solve()


t = int(input())
for i in range(t):
	m = int(input())
	l = list(map(int, input().split()))
	if m == 1 or m == 0:
		print('YES')
	else:
		z = []
		l.sort(reverse=True)
		for j in l:
			if j not in z:
				z.append(j)
		if len(z) == l[0] - l[-1] + 1:
			print('YES')
		else:
			print('NO')


import bisect
import copy
import fractions
import heapq
import math
import random
import sys
T = int(input())
for t in range(T):
	N = int(input())
	n = list(map(int, input().split()))
	n.sort()
	possible = True
	for i in range(len(n) - 1):
		if n[i + 1] - n[i] > 1:
			possible = False
	if possible:
		print('YES')
	else:
		print('NO')


t = int(input())
for j in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	k = sorted(lst)
	c = 0
	for i in range(n - 1):
		if abs(k[i + 1] - k[i]) <= 1:
			c += 1
	if c == n - 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	mini = False
	for i in range(n - 1):
		if arr[i + 1] - arr[i] > 1:
			mini = True
	print('YNEOS'[mini::2])


import sys
input = sys.stdin.readline

def main(n, lst):
	lst = sorted(lst)
	for i in range(1, n):
		if lst[i] != lst[i - 1] + 1 and lst[i] != lst[i - 1]:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	print(main(n, lst))


def rec(l):
	if len(l) == 1:
		return True
	m = min(l)
	l.remove(m)
	if abs(min(l) - m) <= 1:
		return rec(l)
	else:
		return False
t = int(input())
for j in range(t):
	l = list()
	n = int(input())
	if n != 1:
		l = list(map(int, input().split(' ')))
	else:
		l.append(int(input()))
	if rec(l):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	flag = False
	for i in range(len(arr) - 1):
		if arr[i + 1] - arr[i] > 1:
			flag = True
			break
	if flag == True:
		print('NO')
	else:
		print('YES')


import copy
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	c = 0
	for i in range(n - 1):
		if abs(a[i + 1] - a[i]) > 1:
			c = c + 1
			break
	if c != 0:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	input()
	(n, run) = (list(set(map(int, input().split(' ')))), True)
	n.sort()
	while len(n) > 1:
		if abs(n[0] - n[1]) <= 1:
			n.remove(n[0] if n[0] <= n[1] else n[1])
		else:
			print('NO')
			run = False
			break
	if run:
		print('YES')


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


n = int(input())
a = []
b = []
for i in range(n):
	m = int(input())
	l = list(map(int, input().split()))
	a.append(m)
	b.append(l)
c = 0
for i in range(n):
	c = b[i]
	c.sort()
	if len(c) == 1:
		print('YES')
	else:
		for j in range(a[i] - 1):
			if c[j + 1] - c[j] >= 2:
				print('NO')
				break
		else:
			print('YES')


t = int(input())
while t != 0:
	n = int(input())
	list1 = list(map(int, input().split()))
	list1.sort()
	f = 0
	for i in range(1, len(list1)):
		if list1[i] - list1[i - 1] > 1:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')
	t -= 1


for i in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	count = 0
	for j in range(n - 1):
		if l[j] - l[j + 1] < 2 and l[j + 1] - l[j] < 2:
			count = 0
		else:
			count = 1
			break
	if count == 1:
		print('NO')
	else:
		print('YES')


T = int(input())
while T > 0:
	n = int(input())
	line = input().split()
	numbers = []
	for x in line:
		numbers.append(int(x))
	numbers = sorted(numbers)
	good = True
	for i in range(0, n):
		j = i + 1
		if j < n:
			if abs(numbers[i] - numbers[j]) == 1 or abs(numbers[i] - numbers[j]) == 0:
				continue
			else:
				good = False
				break
	if good:
		print('YES')
	else:
		print('NO')
	T -= 1


def one(values):
	values.sort()
	if len(values) == 1:
		return 'YES'
	else:
		for i in range(len(values) - 1):
			if abs(values[i] - values[i + 1]) > 1:
				return 'NO'
		else:
			return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	values = list(map(int, input().split()))
	print(one(values))


import math as mt

def tran(arr):
	arr.sort()
	t = 1
	for i in range(len(arr) - 1):
		if abs(arr[i] - arr[i + 1]) > 1:
			t = 0
			break
	if t == 0:
		return 'NO'
	else:
		return 'YES'
t = int(input())
ans = []
for i in range(t):
	n = int(input())
	arr = list(map(int, input().rstrip().split()))
	r = tran(arr)
	ans.append(r)
for i in ans:
	print(i)


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


import sys
input = sys.stdin.readline

def solve(n, a):
	if n == 1:
		return True
	elif a.count(a[0]) == n:
		return True
	else:
		a.sort()
		for i in range(n - 1):
			if abs(a[i] - a[i + 1]) >= 2:
				return False
		return True
for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if solve(n, a):
		print('YES')
	else:
		print('NO')


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


def main():
	for i in range(int(input())):
		catch = input()
		l = [int(j) for j in input().split()]
		l.sort()
		possible = True
		for j in range(0, len(l) - 1):
			if l[j] + 1 < l[j + 1]:
				possible = False
		if possible == True:
			print('YES')
		else:
			print('NO')
main()


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
letters = ascii_letters[:26]
for _ in range(int(input())):
	n = int(input())
	arr = sorted(list(map(int, input().split())))
	can = True
	for i in range(n - 1):
		if arr[i + 1] - arr[i] > 1:
			can = False
			break
	print('YES' if can else 'NO')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class union_find:

	def __init__(self, n):
		self.n = n
		self.rank = [0] * n
		self.parent = [int(j) for j in range(n)]

	def union(self, i, j):
		i = self.find(i)
		j = self.find(j)
		if self.rank[i] == self.rank[j]:
			self.parent[i] = j
			self.rank[j] += 1
		elif self.rank[i] > self.rank[j]:
			self.parent[j] = i
		else:
			self.parent[i] = j

	def find(self, i):
		temp = i
		if self.parent[temp] != temp:
			self.parent[temp] = self.find(self.parent[temp])
		return self.parent[temp]
from math import log2, ceil
from collections import deque

def main():
	for t in range(int(input())):
		n = int(input())
		l = [int(j) for j in input().split()]
		flag = True
		l.sort()
		for i in range(1, n):
			if l[i] - l[i - 1] > 1:
				flag = False
				break
		if flag:
			print('YES')
		else:
			print('NO')
main()


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


for _ in range(int(input())):
	n = int(input())
	array = list(map(int, input().split()))
	array.sort()
	i = 0
	while i < n - 1:
		if array[i + 1] - array[i] > 1:
			print('NO')
			break
		i += 1
	if i == n - 1:
		print('YES')


import sys, collections, math

def in_out():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
for c in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	f = 0
	for i in range(n - 1):
		if arr[i + 1] - arr[i] > 1:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
n = []
arr = []
for i in range(t):
	n.append(int(input()))
	arr.append(list(map(int, input().split(' '))))
for i in range(t):
	cur = sorted(arr[i])
	nval = n[i]
	if nval == 1:
		print('YES')
		continue
	for j in range(nval - 1, 0, -1):
		if cur[j] - cur[j - 1] <= 1:
			nval -= 1
			if nval == 1:
				print('YES')
				break
	if nval != 1:
		print('NO')


t = int(input())
for some_num in range(0, t):
	n = int(input())
	arr = [int(i) for i in input().split(' ')]
	arr.sort()
	flag = 0
	for i in range(0, n - 1):
		if arr[i + 1] - arr[i] > 1:
			print('NO')
			flag = 1
			break
	if flag != 1:
		print('YES')


for s in [*open(0)][2::2]:
	a = sorted(map(int, s.split()))
	print('YNEOS'[any((y - x > 1 for (x, y) in zip(a, a[1:])))::2])


R = lambda : list(map(int, input().split()))
t = int(input())
for _ in [0] * t:
	n = int(input())
	arr = R()
	arr.sort()
	c = 0
	ans = 'NO'
	if n == 1:
		ans = 'YES'
	else:
		for i in range(n - 1):
			if arr[i + 1] - arr[i] <= 1:
				c += 1
			else:
				c += 0
		if c >= n - 1:
			ans = 'YES'
	print(ans)


n = int(input())

def calc(x, a):
	s = set(a)
	a = list(s)
	a.sort()
	c = 1
	for i in range(len(a) - 1):
		if a[i] + 1 not in a:
			c = c + 1
	if c != 1:
		print('NO')
	else:
		print('YES')
for i in range(n):
	x = int(input())
	a = list(map(int, input().split()))
	calc(x, a)


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


import sys
t = int(input())
while t:
	n = int(input())
	lst = sorted(list(map(int, input().split())))
	sz = len(lst)
	flag = False
	for i in range(1, sz):
		if lst[i] - lst[i - 1] > 1:
			flag = True
			break
	if flag:
		print('NO')
	else:
		print('YES')
	t = t - 1


from __future__ import division, print_function
from sys import stdin, stdout
import bisect
import math
import heapq
i_m = 9223372036854775807

def inin():
	return int(input())

def stin():
	return input()

def spin():
	return map(int, stin().split())

def lin():
	return list(map(int, stin().split()))

def matrix(n):
	return [list(map(int, input().split())) for i in range(n)]

def count2Dmatrix(i, list):
	return sum((c.count(i) for c in list))

def modinv(n, p):
	return pow(n, p - 2, p)

def GCD(x, y):
	x = abs(x)
	y = abs(y)
	if min(x, y) == 0:
		return max(x, y)
	while y:
		(x, y) = (y, x % y)
	return x

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l
prime = []

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j
for _ in range(inin()):
	n = inin()
	a = lin()
	a = sorted(a)
	i = 0
	while len(a) > 1:
		if i + 1 < len(a):
			if math.fabs(a[i] - a[i + 1]) <= 1:
				del a[i]
				i = 0
			else:
				i += 1
		else:
			break
	if len(a) == 1:
		print('YES')
	else:
		print('NO')


t = input()
t = int(t)
for j in range(t):
	n = input()
	n = int(n)
	r = 0
	l = list(map(int, input().split()))
	l.sort()
	if n == 1:
		print('YES')
		continue
	else:
		mi = min(l)
		ma = max(l)
		for i in range(0, len(l)):
			if l[i] - mi <= 1:
				mi = l[i]
				continue
			else:
				r = 1
				break
	if r == 1:
		print('NO')
	else:
		print('YES')


test_cnt = int(input())
tests = []
for _ in range(test_cnt):
	n = int(input())
	a = list(map(int, input().split()))
	tests.append((n, a))
for test in tests:
	n = test[0]
	a = test[1]
	a = sorted(set(a))
	flag = True
	for i in range(len(a) - 1):
		if a[i + 1] - a[i] > 1:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


def solve():
	a = int(input())
	b = sorted(list(map(int, input().split())))
	c = []
	d = 0
	[c.append(x) for x in b if x not in c]
	while d <= len(c) - 1 and d >= 0:
		if len(c) == 1:
			print('YES')
			break
		elif abs(c[d] - c[d + 1]) <= 1:
			c.remove(c[d])
		else:
			print('NO')
			break
for _ in range(int(input())):
	solve()


trial = int(input())
for _ in range(trial):
	num = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	poss = True
	for i in range(len(arr) - 1):
		if arr[i + 1] - arr[i] > 1:
			poss = False
	print('{}'.format('YES' if poss else 'NO'))


set_num = int(input())
for i in range(set_num):
	N = int(input())
	arr = list(map(int, input().split()))
	passed = []
	ar2 = sorted(set(arr))
	ar3 = [x - 1 for x in ar2]
	N = len(set(ar2) - set(ar3))
	print('YES' if N == 1 else 'NO')


import math
from itertools import combinations
from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	f = 1
	a.sort()
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) > 1:
			print('NO')
			f = 0
			break
	if f:
		print('YES')


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


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	hold = None
	for element in arr:
		if hold == None:
			hold = element
			continue
		if abs(element - hold) <= 1:
			n -= 1
		hold = element
	if n == 1:
		print('YES')
	else:
		print('NO')


from sys import stdin

def get_user_input():
	return list(map(int, stdin.readline().rstrip().split()))

def have_one_num(num_list):
	status = True
	for i in range(1, len(num_list)):
		status &= num_list[i] - num_list[i - 1] <= 1
		if not status:
			return status
	return status
t = int(input())
input_list = []
results = []
for i in range(t):
	n = int(input())
	num_list = sorted(get_user_input())
	results.append(have_one_num(num_list))
for res in results:
	if res:
		print('YES')
		continue
	print('NO')


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	max_dif = 0
	length = len(l)
	for i in range(length - 1):
		max_dif = max(max_dif, abs(l[i + 1] - l[i]))
	if max_dif > 1:
		print('NO')
	else:
		print('YES')


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = [int(x) for x in input().split()]
	a = sorted(a)
	printed = False
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			print('NO')
			printed = True
			break
	if not printed:
		print('YES')


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


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


def t(b):
	if b:
		print('YES')
		return
	print('NO')
for _ in range(int(input())):
	a = int(input())
	l = sorted(list(map(int, input().split())))
	for i in range(a - 1):
		if l[i + 1] - l[i] >= 2:
			t(False)
			break
	else:
		t(True)


t = int(input())
while t > 0:
	n = int(input())
	d = 0
	l1 = [int(i) for i in input().split()]
	l1 = sorted(l1)
	for i in range(len(l1) - 1):
		if abs(l1[i] - l1[i + 1]) <= 1:
			continue
		else:
			d = 1
			break
	if d == 0:
		print('YES')
	else:
		print('NO')
	t -= 1


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	ans = 'YES'
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			ans = 'NO'
	print(ans)


import sys

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

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

def solve():
	n = mint()
	a = list(mints())
	a.sort()
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			print('NO')
			return
	print('YES')
for i in range(mint()):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	ans = []
	if n == 1:
		print('YES')
		continue
	lst = sorted(lst)
	for j in range(1, n):
		ans.append(lst[j] - lst[j - 1])
	ans = sorted(ans)
	print(['YES', 'NO'][ans[-1] > 1])


for _ in range(int(input())):
	N = int(input())
	List = [int(x) for x in input().split()]
	fl = 0
	for i in range(min(List), max(List) + 1):
		if i in List:
			continue
		else:
			fl = 1
			break
	if fl:
		print('NO')
	else:
		print('YES')


class solution:

	def __init__(self, array):
		self.array = array

	def onePossible(self):
		res = 'YES'
		arr = sorted(array)
		for i in range(len(arr) - 1):
			if arr[i + 1] - arr[i] > 1:
				res = 'NO'
		return res
t = int(input())
while t > 0:
	n = int(input())
	array = list(map(int, input().split()))
	soln = solution(array)
	print(soln.onePossible())
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	arr = [int(k) for k in input().split()]
	arr.sort()
	output = True
	for j in range(0, len(arr) - 1):
		if arr[j + 1] - arr[j] > 1:
			output = False
			break
	if output:
		print('YES')
	else:
		print('NO')


T = int(input())
for i in range(T):
	N = int(input())
	numbers = [int(i) for i in input().split()]
	numbers.sort()
	flag = 0
	for i in range(0, len(numbers) - 1):
		if numbers[i + 1] - numbers[i] > 1:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


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


from sys import stdin, stdout
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	arr = list(map(int, stdin.readline().strip().split()))
	arr = sorted(arr)
	flg = 0
	for i in range(1, n):
		if arr[i] - arr[i - 1] > 1:
			flg = 1
			break
	if flg:
		print('NO')
	else:
		print('YES')


t = int(input())
arr = []
for j in range(t):
	n = int(input())
	a = []
	b = []
	a = [int(x) for x in input().split()]
	a.sort()
	for i in range(len(a) - 1):
		j = i + 1
		if abs(a[i] - a[j]) <= 1:
			if a[i] >= a[j]:
				b.append(a[j])
			else:
				b.append(a[i])
	if len(a) - len(b) == 1:
		arr.append('YES')
	else:
		arr.append('NO')
for i in arr:
	print(i)


def solve(arr, n):
	max_diff = 0
	arr.sort()
	for i in range(1, n):
		if abs(arr[i] - arr[i - 1]) > 1:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	print(solve(arr, n))


from collections import Counter
T = int(input())
for t in range(T):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	(i, j) = (0, 1)
	while j < n:
		if abs(l[i] - l[j]) <= 1:
			i += 1
			j += 1
		else:
			break
	if j == n:
		print('YES')
	else:
		print('NO')


import sys

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

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

def solve(n, l):
	l = sorted(l)
	for i in range(len(l) - 1):
		if l[i + 1] - l[i] > 1:
			return False
	return True

def main():
	t = int(input())
	for i in range(t):
		n = MI()
		l = LI()
		print('YES' if solve(n, l) else 'NO')
main()


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	flag = False
	a.sort(reverse=True)
	if len(a) == 1:
		print('YES')
		continue
	for i in range(1, len(a)):
		if abs(a[i] - a[i - 1]) > 1:
			flag = True
	print('YES') if flag == False else print('NO')


test = 0
t = int(input())
ls = []
for i in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	a = list(dict.fromkeys(a))
	a.sort()
	test = 1
	for j in range(0, len(a) - 1):
		if a[j + 1] - a[j] > 1:
			test = 0
			break
	if len(a) == 1:
		ls.append('YES')
	elif test == 0:
		ls.append('NO')
	else:
		ls.append('YES')
for x in ls:
	print(x)


for num in range(int(input())):
	an = int(input())
	al = list(map(int, input().split()))
	al.sort()
	state = True
	for i in range(len(al) - 1):
		if al[i + 1] - al[i] > 1:
			state = False
			break
	if state:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout

def INPUT():
	return list((int(i) for i in stdin.readline().split()))

def inp():
	return stdin.readline()

def out(x):
	return stdout.write(x)
import math
for _ in range(int(input())):
	n = int(input())
	A = INPUT()
	A.sort()
	bool = True
	for i in range(1, n):
		if A[i] - A[i - 1] > 1:
			bool = False
			break
	if bool is True:
		print('YES')
	else:
		print('NO')


n = int(input())
for z in range(n):
	m = int(input())
	li = list(map(int, input().split()))
	li.sort()
	i = 0
	while i < len(li) - 1:
		if li[i + 1] - li[i] <= 1:
			li.pop(i)
			i = 0
		else:
			i = i + 1
			break
	if len(li) == 1:
		print('YES')
	else:
		print('NO')


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def solve():
	n = I()
	a = li()
	a.sort()
	flag = 1
	for i in range(n - 1):
		if a[i + 1] - a[i] <= 1:
			continue
		flag = 0
		break
	if flag:
		print('YES')
	else:
		print('NO')
for _ in range(I()):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	a_in = input()
	a = a_in.split()
	a = list(map(int, a))
	a.sort()
	if n == 1:
		print('YES')
		continue
	else:
		total = sum(a)
		for i in range(1, n):
			if a[i] - a[i - 1] <= 1:
				total -= a[i - 1]
				a[i - 1] = 0
	if a[i] == total:
		print('YES')
	else:
		print('NO')


import time, math as mt, bisect, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IO():
	return stdin.readline()

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

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

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * (2 * 10 ** 5 + 5)
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(2 * 10 ** 5 + 5):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def SPF():
	spf[1] = 1
	for i in range(2, mx + 1):
		if spf[i] == mx:
			spf[i] = i
			for j in range(i * i, mx + 1, i):
				if i < spf[j]:
					spf[j] = i
	return

def readTree(n, e):
	adj = [set() for i in range(n + 1)]
	for i in range(e):
		(u1, u2) = IP()
		adj[u1].add(u2)
	return adj
mod = 10 ** 9 + 7

def solve():
	n = II()
	li = L()
	if n == 1:
		P('YES')
		return
	li.sort()
	for i in range(n - 1):
		if li[i + 1] - li[i] > 1:
			P('NO')
			return
	P('YES')
	return
t = II()
for i in range(t):
	solve()


for _ in [0] * int(input()):
	(n, j) = (int(input()), 0)
	a = list(map(int, input().split()))
	for i in range(min(a), max(a)):
		if i not in a:
			j = 1
			break
	print('YNEOS'[j::2])


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	arr = list(set(arr))
	ans = arr.copy()
	for i in range(len(arr)):
		for j in range(i + 1, len(arr)):
			if i != j and abs(arr[i] - arr[j]) <= 1:
				try:
					ans.remove(min(arr[i], arr[j]))
				except:
					pass
	if len(ans) == 1:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	nums = [int(x) for x in input().split()]
	nums.sort()
	for i in range(n - 1):
		if nums[0] == nums[1] or nums[1] == nums[0] + 1:
			nums.pop(0)
		else:
			print('NO')
			break
	if len(nums) == 1:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	fl = True
	for j in range(len(a)):
		if a[j] + 1 not in a and a[j] != a[-1]:
			print('NO')
			fl = False
			break
	if fl:
		print('YES')


N = int(input())
for _ in range(N):
	n = int(input())
	data = input()
	split = data.split(' ')
	numbers = []
	for x in split:
		numbers.append(int(x))
	if n == 1:
		print('YES')
	else:
		yes = True
		a = [False] * 200
		for i in range(n):
			a[numbers[i]] = True
		for j in range(200):
			if a[j]:
				zac = j
				break
		for j in range(200):
			if a[199 - j]:
				kon = 199 - j
				break
		for j in range(zac, kon):
			if not a[j]:
				yes = False
				break
		if yes:
			print('YES')
		else:
			print('NO')


def possible(arr, n):
	arr.sort()
	for i in range(1, n):
		if arr[i] - arr[i - 1] <= 1:
			arr[i - 1] = -1
	counter = 0
	for i in range(n):
		if arr[i] != -1:
			counter += 1
	return counter == 1
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().rstrip().split()))
	if possible(arr, n):
		print('YES')
	else:
		print('NO')


testcase = int(input())
while testcase > 0:
	n = int(input())
	array = [int(i) for i in input().split()]
	array.sort()
	smaller = [abs(array[i] - array[i + 1]) <= 1 for i in range(n - 1)]
	if all(smaller) or smaller == []:
		print('YES')
	else:
		print('NO')
	testcase -= 1


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


def anss(arr):
	n = len(arr)
	if n == 1:
		return True
	arr.sort()
	for i in range(n - 1):
		if arr[i + 1] - arr[i] == 0 or arr[i + 1] - arr[i] == 1:
			continue
		else:
			return False
	return True
for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	k = anss(a)
	if k:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	check = 0
	for i in range(1, len(arr)):
		if arr[i] - arr[i - 1] > 1:
			check = 1
			break
	if check == 1:
		print('NO')
	else:
		print('YES')


for t in range(int(input())):
	n = int(input())
	nums = list(map(int, input().split(' ')))
	if not n:
		print('NO')
		continue
	if n == 1:
		print('YES')
		continue
	(nums, is_possible) = (sorted(nums), True)
	for i in range(n - 1):
		if abs(nums[i] - nums[i + 1]) > 1:
			is_possible = False
			break
	if is_possible:
		print('YES')
	else:
		print('NO')


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


def f():
	n = int(input())
	vs = sorted(map(int, input().split()))
	if len(vs) == 1:
		return 'YES'
	for i in range(1, n):
		if abs(vs[i - 1] - vs[i]) > 1:
			return 'NO'
	return 'YES'
t = int(input())
for _ in range(t):
	print(f())


t = int(input())
while t > 0:
	n = int(input())
	y = list(map(int, input().split()))
	x = list()
	x = sorted(y)
	count = 0
	i = 0
	a = len(x)
	if len(x) == 1:
		print('YES')
		t = t - 1
		continue
	else:
		while i < len(x):
			for j in range(i + 1, len(x)):
				if abs(x[i] - x[j]) <= 1:
					if x[i] <= x[j]:
						x.pop(i)
					else:
						x.pop(j)
					count = count + 1
					i = -1
					break
			i = i + 1
		if a - count == 1:
			print('YES')
		else:
			print('NO')
	t = t - 1


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


def func(n, arr):
	arr.sort()
	for i in range(1, n):
		if arr[i] - arr[i - 1] > 1:
			return 'NO'
	return 'YES'
for t in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	print(func(n, arr))


t = int(input())
for i in range(t):
	n = int(input())
	arr = [eval(x) for x in input().split()]
	count = 1
	length = len(arr)
	arr.sort()
	if length == 1:
		print('YES')
	else:
		for j in range(1, length):
			if abs(arr[j] - arr[j - 1]) <= 1:
				count += 1
			else:
				print('NO')
				break
		if count == length:
			print('YES')


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


from sys import stdin, stdout
import math
from collections import Counter, deque
L = lambda : deque(list(map(int, stdin.readline().strip().split())))
M = lambda : map(int, stdin.readline().strip().split())
I = lambda : int(stdin.readline().strip())
IN = lambda : stdin.readline().strip()
C = lambda : stdin.readline().strip().split()
mod = 1000000007

def s(a):
	print(''.join(list(map(str, a))))

def solve():
	n = I()
	a = L()
	a = sorted(a)
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			print('NO')
			return
	print('YES')
for _ in range(I()):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort(reverse=True)
	c = 0
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) <= 1:
			pass
		else:
			c = 1
			break
	if c == 0:
		print('YES')
	else:
		print('NO')


def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		if n == 1:
			print('YES')
		else:
			flag = True
			for i in range(n - 1):
				if abs(a[i] - a[i + 1]) <= 1:
					pass
				else:
					flag = False
			if flag:
				print('YES')
			else:
				print('NO')
main()


import sys

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

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

def ws(s):
	sys.stdout.write(s)
	sys.stdout.write('\n')

def wi(n):
	sys.stdout.write(str(n))
	sys.stdout.write('\n')

def wia(a, sep=' '):
	sys.stdout.write(sep.join([str(x) for x in a]))
	sys.stdout.write('\n')

def solve(n, a):
	mn = min(a)
	mx = max(a)
	s = set(a)
	for x in range(mn, mx + 1):
		if x not in s:
			return False
	return True

def main():
	for _ in range(ri()):
		n = ri()
		a = ria()
		ws('YES' if solve(n, a) else 'NO')
main()


def res(l):
	for i in range(len(l) - 1):
		if abs(l[i] - l[i + 1]) > 1:
			return -1
	return 1
n = int(input())
for i in range(n):
	v = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	v = res(l)
	if v == 1:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	x = int(input())
	A = list(map(int, input().split()))
	A.sort()
	k = x
	for j in range(x - 1):
		if abs(A[j] - A[j + 1]) <= 1:
			k -= 1
	if k == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
ergL = []
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	p = True
	for i in range(1, n):
		if arr[i] - arr[i - 1] > 1:
			p = False
			break
	if p:
		ergL.append('YES')
	else:
		ergL.append('NO')
for i in ergL:
	print(i)


import sys
q = int(input())
for i in range(q):
	n = int(sys.stdin.readline())
	a = [int(j) for j in sys.stdin.readline().split()]
	problem = 0
	a.sort()
	for j in range(len(a) - 1):
		if a[j] + 1 < a[j + 1]:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	li = list(map(int, input().split()))
	li.sort()
	flag = 0
	for i in range(1, len(li)):
		if li[i] - li[i - 1] >= 2:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	list1 = [int(a) for a in input().split()]
	if n == 1:
		print('YES')
		continue
	list1.sort()
	flag = 0
	for x in range(len(list1) - 1):
		if list1[x + 1] - list1[x] > 1:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


import math
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split(' ')))
	l.sort()
	flag = 0
	for j in range(1, n):
		if abs(l[j] - l[j - 1]) > 1:
			flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


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


t = int(input())
for i in range(t):
	n = int(input())
	arr = [int(inp) for inp in input().split()]
	arr = sorted(arr)
	if len(arr) == 1:
		print('YES')
		continue
	r = 'YES'
	for j in range(1, len(arr)):
		if arr[j] - arr[j - 1] > 1:
			r = 'NO'
			break
	print(r)


def remove(aa):
	n = len(aa)
	l = aa[0]
	for i in range(0, n):
		if abs(aa[i] - l) > 1:
			return 'NO'
		l = aa[i]
	return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	aa = sorted(a)
	print(remove(aa))


from collections import Counter
tst = int(input())
t = 1
while t <= tst:
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	i = 1
	fg = True
	mx = 1
	while i < len(arr):
		if arr[i] - arr[i - 1] > 1:
			fg = False
			break
		i += 1
	if fg == False:
		print('NO')
	else:
		print('YES')
	t += 1


n = int(input())
for i in range(n):
	m = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	q = 0
	for j in range(1, len(a)):
		if a[j] - a[j - 1] < 2:
			q += 1
	if q == m - 1:
		print('YES')
	else:
		print('NO')


import math
import sys
import bisect
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ch = 0
	for i in range(n - 1):
		if l[i + 1] - l[i] > 1:
			ch = 1
			break
	if ch == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	x = list(set(map(int, input().split())))
	if len(x) == 1:
		print('YES')
	else:
		mx = max(x)
		mn = min(x) - 1
		if sum(x) != mx * (mx + 1) / 2 - mn * (mn + 1) / 2:
			print('NO')
		else:
			print('YES')


def RemoveNumBFS(nums):
	queue = []
	queue.append(nums[0])
	while queue:
		current = queue.pop(0)
		if len(nums) == 1:
			print('YES')
			return
		sig1 = nums.index(current) + 1
		sig2 = nums.index(current) - 1
		if sig1 < len(nums):
			if nums[sig1] - current == 1 or nums[sig1] - current == 0:
				nums.remove(current)
				queue.append(nums[sig1 - 1])
			elif current - nums[sig1] == 1:
				queue.append(nums[sig1 - 1])
				nums.remove(nums[sig1])
		if sig2 >= 0:
			if nums[sig2] - current == 1:
				nums.remove(current)
				queue.append(nums[sig2 + 1])
			elif current - nums[sig2] == 1 or current - nums[sig2] == 0:
				nums.remove(nums[sig1])
				queue.append(nums[sig2 + 1])
	print('NO')
	return

def RemoveNum(nums):
	nums = sorted(nums)
	for i in range(len(nums) - 1):
		if abs(nums[i] - nums[i + 1]) > 1:
			print('NO')
			return
	print('YES')
tests = int(input())
for test in range(tests):
	size = int(input())
	arr = input().split(' ')
	for i in range(len(arr)):
		arr[i] = int(arr[i])
	RemoveNum(arr)


from collections import Counter
t = int(input().strip())
while t > 0:
	n = int(input().strip())
	a = list(map(int, input().strip().split()))
	counts = Counter(a)
	l = sorted(counts.keys())
	prev = l[0]
	res = 'YES'
	for x in l[1:]:
		if x > prev + 1:
			res = 'NO'
			break
		prev = x
	print(res)
	t -= 1


cases = int(input())
for x in range(cases):
	input()
	stringNums = input().split(' ')
	nums = list((int(x) for x in stringNums))
	numsUnique = sorted(list(set(nums)))
	if numsUnique[-1] + 1 - len(numsUnique) == numsUnique[0]:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	length = int(input())
	array = list(map(int, input().split()))
	array.sort()
	pre = array[0]
	result = True
	for i in array[1:]:
		if i > pre + 1:
			result = False
		pre = i
	if result:
		print('YES')
	else:
		print('NO')


t = int(input())
d = {}
for i in range(t):
	n = int(input())
	s = str(input()).split(' ')
	d[i] = (n, s)
for key in d.keys():
	answer = 'YES'
	dd = sorted(d[key][1])
	ddd = []
	for i in range(len(dd)):
		ddd.append(int(dd[i]))
	for i in range(len(ddd) - 1):
		if int(sorted(ddd)[i + 1]) - int(sorted(ddd)[i]) > 1:
			answer = 'NO'
			break
	print(answer)


import math

def ans():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	lis = []
	if n == 1:
		print('YES')
		return
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) > 1:
			print('NO')
			return
		else:
			continue
	print('YES')
	return
t = int(input())
while t > 0:
	ans()
	t -= 1


n = int(input())
while n:
	n -= 1
	length = int(input())
	data = list(map(int, input().split()))
	data.sort()
	flag = False
	for i in range(length - 1):
		if data[i + 1] - data[i] > 1:
			print('NO')
			flag = True
			break
	if not flag:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	ls = sorted(set(list(map(int, input().split()))))
	flg = True
	for i in range(1, len(ls)):
		if ls[i] - ls[i - 1] > 1:
			flg = False
			break
	print('YES' if flg else 'NO')


t = int(input())

def checkA(arr):
	for i in range(1, len(arr)):
		if abs(arr[i] - arr[i - 1]) > 1:
			return False
	return True
for testIteration in range(t):
	n = int(input())
	arr = []
	while len(arr) < n:
		arr.extend([int(s) for s in input().split(' ')])
	arr.sort()
	if checkA(arr):
		print('YES')
	else:
		print('NO')


def solve(a):
	a.sort()
	while len(a) >= 2:
		if abs(a[0] - a[1]) <= 1:
			if a[0] > a[1]:
				a.pop(1)
			else:
				a.pop(0)
		else:
			return 'NO'
	if len(a) == 1:
		return 'YES'
for _ in range(int(input())):
	_ = input()
	a = list(map(int, input().split(' ')))
	print(solve(a))


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


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
for case in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a = set(a)
	a = list(a)
	a.sort()
	valid = True
	for i in range(len(a) - 1):
		if a[i + 1] != a[i] + 1:
			valid = False
			break
	if valid:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	mn = a[0]
	flag = 1
	for i in a:
		if i - mn <= 1:
			mn = i
		else:
			flag = 0
			break
	if flag:
		print('YES')
	else:
		print('NO')


import copy
import math
r = int(input())
for l in range(r):
	n = int(input())
	arr = [int(d) for d in input().split()]
	if n == 1:
		print('YES')
	else:
		arr.sort()
		k = 0
		for i in range(1, n):
			if arr[i] - arr[i - 1] > 1:
				k += 1
			if k >= 1:
				print('NO')
				break
		if k == 0:
			print('YES')


def func(A):
	if len(A) == 1:
		return 'YES'
	i = 0
	A.sort()
	while i < len(A) - 1:
		if abs(A[i] - A[i + 1]) > 1:
			return 'NO'
		i += 1
	return 'YES'
testcases = int(input())
for t in range(testcases):
	_ = input()
	A = [int(i) for i in input().split()]
	print(func(A))


t = int(input())
for _ in range(t):
	n = int(input())
	l1 = [int(i) for i in input().split()]
	l1.sort()
	f = 0
	for i in range(n - 1):
		if abs(l1[i] - l1[i + 1]) <= 1:
			continue
		else:
			f = 1
			break
	if f == 0:
		print('YES')
	else:
		print('NO')


def suka(a):
	a = sorted(list(set(a)))
	fl = 0
	if len(a) == 1:
		return 'YES'
	else:
		for i in range(1, len(a)):
			if a[i] - a[i - 1] > 1:
				fl = 1
				break
		if fl:
			return 'NO'
		else:
			return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	a = map(float, input().split())
	if n == 1:
		print('YES')
	else:
		print(suka(a))


n = int(input())
li = []

def solve(t, s):
	s.sort()
	for j in range(1, t):
		if s[j] - s[j - 1] > 1:
			return 'NO'
	return 'YES'
for i in range(n):
	t = int(input())
	s = list(map(int, input().split()[:t]))
	li.append(solve(t, s))
for a in li:
	print(a)


t = int(input())
for _ in range(t):
	n = int(input())
	num = list(map(int, input().split()))
	if len(num) == 1:
		print('YES')
	else:
		num.sort()
		for i in range(n - 1):
			if num[i + 1] - num[i] <= 1:
				num[i] = '*'
		while '*' in num:
			num.remove('*')
		if len(num) > 1:
			print('NO')
		else:
			print('YES')


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	(n,) = I()
	l = I()
	l.sort()
	fl = 1
	for i in range(n - 1):
		if l[i] == l[i + 1] or l[i] == l[i + 1] - 1:
			continue
		fl = 0
	print('YES' if fl else 'NO')


def fcnt():
	result = ''
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		for i in range(n - 1):
			if abs(a[i] - a[i + 1]) > 1:
				result += 'NO\n'
				break
		else:
			result += 'YES\n'
	print(result)
fcnt()


for i in range(int(input())):
	n = int(input())
	a = []
	a = list(map(int, input().strip().split()))[:n]
	a.sort()
	flag = 0
	for j in range(n - 1):
		if a[j + 1] - a[j] > 1:
			flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	k = list(map(int, input().split()))
	k = sorted(k)
	p = 1
	for j in range(len(k) - 1):
		if abs(k[j] - k[j + 1]) > 1:
			p = 0
	if p == 0:
		print('NO')
	else:
		print('YES')


import math

def dtb(n):
	return bin(n).replace('0b', '')

def btd(n):
	return int(n, 2)
t = int(input())
for k in range(t):
	n = int(input())
	a = list(map(int, input().split()))[:n]
	a.sort()
	count = 0
	for i in range(1, n):
		if a[i] - a[i - 1] <= 1:
			count += 1
	if count == n - 1:
		print('YES')
	else:
		print('NO')


sets = int(input())
for _ in range(sets):
	count_numbers = input()
	numbers = set(map(int, input().split()))
	sorted_numbers = sorted(numbers)
	if len(sorted_numbers) == 1:
		print('YES')
	for index in range(len(sorted_numbers) - 1):
		if abs(sorted_numbers[index] - sorted_numbers[index + 1]) > 1:
			print('NO')
			break
		if index == len(sorted_numbers) - 1 - 1:
			print('YES')


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left
from bisect import bisect_right

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007

def main():
	for t in range(I()):
		n = I()
		arr = L()
		arr.sort()
		if n == 1:
			print('YES')
		else:
			flag = 1
			for i in range(1, n):
				if arr[i] - arr[i - 1] > 1:
					flag = 0
					break
			if flag:
				print('YES')
			else:
				print('NO')
main()


from collections import defaultdict, deque
from bisect import bisect_left as lower
import sys

def put():
	return map(int, input().split())
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(put())
	l.sort()
	prev = l[0]
	flag = 'YES'
	for i in l:
		if i - prev > 1:
			flag = 'NO'
			break
		prev = i
	print(flag)


t = int(input())

def func(mat, i, j, n):
	if i == n - 1 and j == n - 1:
		return mat[i][j]
	elif i > n - 1 or i < 0 or j > n - 1 or (j < 0):
		return 100000
	elif mat[i][j] == -1:
		return 100000
	else:
		k = mat[i][j]
		mat[i][j] = -1
		ans = k + min(func(mat, i + 1, j, n), func(mat, i - 1, j, n), func(mat, i, j + 1, n), func(mat, i, j - 1, n))
		print(i, j, ans)
		return ans
		mat[i][j] = k
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	f = 0
	for i in range(len(l) - 1):
		if l[i + 1] - l[i] > 1:
			f = 1
	if f == 1:
		print('NO')
	else:
		print('YES')


import sys, collections, math

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

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

def input():
	return sys.stdin.readline().strip()
mod = 1000000007
for _ in range(int(input())):
	n = int(input())
	arr = get_array()
	arr.sort()
	s = len(arr)
	for i in range(1, n):
		if abs(arr[i] - arr[i - 1]) <= 1:
			s -= 1
	if s == 1:
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	k = int(input())
	t = list(map(int, input().split()))
	r = []
	t.sort()
	x = 0
	while x + 1 < len(t):
		p = t[x]
		if abs(t[x] - t[x + 1]) <= 1:
			t = t[x + 1:]
			x -= 1
		else:
			r.append(t[x])
		x += 1
	if len(t + r) == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(0, t):
	flag = 0
	n = int(input())
	array = list(map(int, input().rsplit()))
	array.sort(reverse=False)
	for j in range(1, n):
		if array[j] - array[j - 1] > 1:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
while t > 0:
	n = int(input())
	li = list(map(int, input().split(' ')))
	li = sorted(list(set(li)))
	if len(li) == 1:
		print('YES')
	else:
		current = li[0]
		ans = True
		for i in li[1:]:
			if i - current != 1:
				ans = False
				break
			current = i
		if ans:
			print('YES')
		else:
			print('NO')
	t -= 1


n = int(input())
for i in range(0, n):
	l = int(input())
	l1 = list(map(int, input().split()))
	f = 0
	m = sorted(l1)
	for k in range(1, l):
		if m[k] - m[k - 1] > 1:
			print('NO')
			f = 1
			break
	if f == 0:
		print('YES')


tc = int(input())
for _ in range(0, tc):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	flag = False
	for index in range(1, n):
		if a[index] - a[index - 1] > 1:
			flag = True
			break
	if flag:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	s = list(set(l))
	s.sort()
	for i in range(len(s)):
		if i == len(s) - 1:
			print('YES')
			break
		if abs(s[i] - s[i + 1]) > 1:
			print('NO')
			break


for i in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))[:n]
	li.sort()
	count = 0
	if n == 1:
		print('YES')
	else:
		for j in range(1, n):
			if li[j] - li[j - 1] <= 1:
				count = 0
			else:
				count = 1
				break
		if count == 0:
			print('YES')
		elif count == 1:
			print('NO')


output = []
for i in range(int(input())):
	n = int(input())
	a_list = list(map(int, input().split()))
	a_list.sort()
	for j in range(n - 1):
		j = 0
		if a_list[j + 1] - a_list[j] == 1 or a_list[j + 1] - a_list[j] == 0:
			a_list.pop(j)
	if len(a_list) == 1:
		output.append('YES')
	else:
		output.append('NO')
print(*output, sep='\n')


t = int(input())
for i in range(t):
	n = int(input())
	inp = list(map(int, input().split()))
	inp = sorted(inp)
	fl = True
	for j in range(n - 1):
		if inp[j + 1] - inp[j] > 1:
			fl = False
			print('NO')
			break
	if fl:
		print('YES')


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	for i in range(n - 1):
		x = a.pop()
		y = a.pop()
		if y - x < 2:
			a.append(y)
		else:
			print('NO')
			return
	print('YES')
for i in range(int(input())):
	solve()


T = int(input())
r = []
for k in range(T):
	s = int(input())
	l = list(map(int, input().split()))
	m = sorted(l)
	fl = 0
	for i in range(len(l)):
		if i != len(l) - 1:
			if m[i + 1] - m[i] > 1:
				fl = 1
				r.append('NO')
				break
	if fl == 0:
		r.append('YES')
for y in range(T):
	print(r[y])


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print('YES')
	else:
		a.sort()
		s = 0
		for j in range(n - 1):
			if a[j + 1] - a[j] <= 1:
				s += 1
		if s > n - 2:
			print('YES')
		else:
			print('NO')


from collections import defaultdict as dd
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = dd(int)
	for i in a:
		d[i] = d.get(i, 0) + 1
	fg = 0
	a.sort()
	for i in a:
		if i - 1 in d and d[i - 1] > 0:
			d[i - 1] -= 1
		elif d[i] >= 2:
			d[i] -= 1
		elif i + 1 in d and d[i + 1] > 0:
			d[i] -= 1
		else:
			fg = 1
			break
	ct = 0
	for i in d.keys():
		ct += d[i]
	if ct > 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	ans = 'YES'
	s = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	for i in range(s - 1):
		if abs(arr[i] - arr[i + 1]) > 1:
			ans = 'NO'
			break
	print(ans)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	f = True
	l.sort()
	c = n
	for i in range(1, n):
		if l[i] - l[i - 1] <= 1:
			c -= 1
	if c == 1:
		print('YES')
	else:
		print('NO')


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


import sys

def solve(a):
	a.sort()
	n = len(a)
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			return False
	return True
t = int(input())
for _ in range(t):
	ln1 = next(sys.stdin)
	ln2 = next(sys.stdin)
	a = list(map(int, ln2.split()))
	print('YES' if solve(a) else 'NO')


def test(numbers):
	numbers = set(numbers)
	numbers = sorted(numbers)
	length = len(numbers)
	if numbers[-1] == numbers[0] + length - 1:
		return 'YES'
	return 'NO'
for i in range(int(input())):
	input()
	numbers = list(map(int, input().split(' ')))
	print(test(numbers))


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


n = int(input())
tests = [(input(), list(map(int, input().split()))) for _ in range(n)]
ans = []
for _ in tests:
	i = 0
	test = _[1]
	test.sort()
	length = len(test) - 1
	while i < length:
		if test[i + 1] == test[i] + 1 or test[i + 1] == test[i]:
			test.remove(test[i])
			length -= 1
		else:
			i += 1
	if len(test) == 1:
		ans.append('YES')
	else:
		ans.append('NO')
[print(_) for _ in ans]


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ok = True
	for i in range(1, n):
		prev = a[i - 1]
		if a[i] == prev or a[i] == prev + 1:
			pass
		else:
			ok = False
			break
	if ok:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	ch = input()
	L = [int(i) for i in ch.split()]
	L.sort()
	test = True
	for i in range(n - 1):
		if abs(L[i] - L[i + 1]) > 1:
			test = False
	if test:
		print('YES')
	else:
		print('NO')


lst = []
t = int(input())
for j in range(0, t):
	n = int(input())
	input_string = input('')
	lst = input_string.split()
	for i in range(len(lst)):
		lst[i] = int(lst[i])
	lst.sort()
	flag = True
	for i in range(1, n):
		if lst[i] - lst[i - 1] > 1:
			flag = False
			print('NO')
			break
	if flag == True:
		print('YES')


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
from collections import deque as que, defaultdict as vector
from bisect import bisect as bsearch
from heapq import *
inin = lambda : int(input())
inar = lambda : list(map(int, input().split()))
INF = float('inf')
testcase = inin()
for Case in range(testcase):
	n = inin()
	a = inar()
	a.sort()
	ans = 'YES'
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			ans = 'NO'
	print(ans)


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


t = int(input())
for i in range(t):
	b = int(input())
	m = []
	r = input().split()
	for j in range(len(r)):
		m.append(int(r[j]))
	m.sort()
	k = 0
	for j in range(len(m) - 1):
		if abs(m[j] - m[j + 1]) > 1:
			k = 1
	if k == 0:
		print('YES')
	else:
		print('NO')


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


for _ in range(int(input())):
	n = int(input())
	ls = [int(i) for i in input().split()]
	ls.sort()
	br = 0
	for i in range(n - 1):
		if ls[i + 1] - ls[i] > 1:
			br = 1
			print('NO')
			break
	if br == 0:
		print('YES')


import sys, math, heapq, copy
from collections import defaultdict, deque
from bisect import bisect_left, bisect_right
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	flag = 0
	for i in range(1, n):
		if l[i] - l[i - 1] > 1:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


import sys

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

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

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	arr = get_array()
	arr.sort()
	f = 0
	if n == 1:
		print('YES')
	else:
		for i in range(0, n - 1):
			if abs(arr[i] - arr[i + 1]) > 1:
				f = 1
				break
		if f == 1:
			print('NO')
		else:
			print('YES')


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


def small(y, z):
	k = len(y)
	s = y[0]
	for j in range(0, z):
		if abs(y[j] - s) > 1:
			return 'NO'
		s = y[j]
	return 'YES'
for j in range(int(input())):
	z = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	print(small(ar, z))


t = int(input())
for _ in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	flag = 1
	for i in range(1, n):
		if abs(l[i] - l[i - 1]) > 1:
			print('NO')
			flag = 0
			break
	if flag == 1 or n == 1:
		print('YES')


def check(arr, n):
	for j in range(n - 1):
		if arr[j] != arr[j + 1] - 1 and arr[j] != arr[j + 1]:
			return False
	return True
for i in range(int(input())):
	n = int(input())
	arr = sorted([int(elem) for elem in input().split()])
	if not check(arr, n):
		print('NO')
	else:
		print('YES')


t = int(input())
for tests in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr = sorted(arr)
	flag = 0
	for i in range(n - 1):
		if arr[i + 1] - arr[i] > 1:
			flag = 1
			print('NO')
			break
	if flag == 0:
		print('YES')


def solve(aas):
	aas = sorted(aas)
	for (a, b) in zip(aas, aas[1:]):
		if b > a + 1:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	aas = [int(x) for x in input().split()]
	print(solve(aas))


t = int(input())
while t:
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	k = l[0]
	for i in range(n):
		if l[i] != k and l[i] != k + 1:
			print('NO')
			break
		if l[i] == k + 1:
			k += 1
	else:
		print('YES')
	t -= 1


t = int(input())
for T in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	if any([a[i + 1] - a[i] > 1 for i in range(n - 1)]):
		print('NO')
	else:
		print('YES')


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


def merge(sorted_1, sorted_2):
	ans = []
	count = len(sorted_1) + len(sorted_2)
	while len(ans) < count:
		if len(sorted_2) == 0:
			for x in sorted_1:
				ans.append(x)
		elif len(sorted_1) == 0:
			for x in sorted_2:
				ans.append(x)
		elif sorted_1[0] <= sorted_2[0]:
			ans.append(sorted_1[0])
			sorted_1.pop(0)
		else:
			ans.append(sorted_2[0])
			sorted_2.pop(0)
	return ans

def merge_sort(array):
	ans = []
	for x in array:
		ans.append([x])
	while len(ans) > 1:
		for i in range(len(ans) // 2):
			ans[i] = merge(ans[i], ans[i + 1])
			ans.pop(i + 1)
	return ans[0]
for _ in range(int(input())):
	k = int(input())
	array = [int(x) for x in input().split(' ')]
	a = merge_sort(array)
	for _ in range(len(a) - 1):
		if k > 0:
			if a[1] - a[0] > 1:
				break
			else:
				a.pop(0)
				k -= 1
	if len(a) == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	ans = True
	for x in range(1, n):
		if arr[x] - arr[x - 1] > 1:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

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

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

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]
for _ in range(II()):
	n = II()
	aa = LI()
	aa.sort()
	for i in range(n - 1):
		if aa[i + 1] - aa[i] > 1:
			print('NO')
			break
	else:
		print('YES')


tests = int(input())
for i in range(tests):
	n = int(input())
	a = [int(x) for x in input().split()]
	if len(a) == 1:
		print('YES')
		continue
	a.sort()
	s = sum(a)
	for i in range(1, len(a)):
		if a[i] - a[i - 1] <= 1:
			s -= a[i - 1]
			a[i - 1] = 0
	if a[i] == s:
		print('YES')
	else:
		print('NO')


q = int(input())
for d in range(q):
	ast = int(input())
	lt = list(map(int, input().split(' ')))
	lt.sort()
	ans = 0
	for i in range(len(lt) - 1):
		a = lt[i]
		b = lt[i + 1]
		temp = abs(a - b)
		if temp > 1:
			ans = 1
			break
	if ans == 1:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	input()
	l = list(map(int, input().split()))
	l.sort()
	t = False
	for (index, item) in enumerate(l):
		try:
			if l[index + 1] - item > 1:
				print('NO')
				t = True
				break
		except:
			pass
	if not t:
		print('YES')


for _ in range(int(input())):
	N = int(input())
	X = sorted(list(map(int, input().split())))
	print('NO' if any([i > 1 for i in [X[i] - X[i - 1] for i in range(1, N)]]) else 'YES')


for t in range(int(input())):
	n = int(input())
	F = [int(i) for i in input().split()]
	F.sort()
	c = 0
	d = 0
	for i in range(len(F) - 1):
		d = F[i + 1] - F[i]
		if d > c:
			c = d
	if c <= 1:
		print('YES')
	else:
		print('NO')


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
import math
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		x = 'YES'
		for i in range(1, len(a)):
			if a[i] - a[i - 1] > 1:
				x = 'NO'
		print(x)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	rough = []
	p = 0
	a.sort()
	if n == 1:
		print('YES')
	else:
		for i in range(1, n):
			k = abs(a[i] - a[i - 1])
			rough.append(k)
		for i in rough:
			if i > 1 or i < -1:
				p = 1
		if p == 0:
			print('YES')
		else:
			print('NO')


def solve(testcase):
	for (a, b) in zip(testcase, testcase[1:]):
		if b - a > 1:
			return False
	return True
t = int(input())
for _ in range(t):
	n = int(input())
	if solve(sorted(list(map(int, input().split())))):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = input()
	nums = [int(x) for x in input().split()]
	nums.sort()
	i = 0
	j = 1
	while i + 1 < len(nums):
		if nums[j] > nums[i] + 1:
			break
		else:
			del nums[i]
	if len(nums) == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	(i, j) = (0, 1)
	while len(arr) > 1:
		if abs(arr[i] - arr[j]) > 1:
			break
		elif abs(arr[i] - arr[j]) <= 1:
			del arr[i]
	if len(arr) == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	b = []
	i = 0
	ok = True
	while len(a) > 1:
		if abs(a[i] - a[i + 1]) <= 1:
			ind = a.index(min(a[i], a[i + 1]))
			a.pop(ind)
		else:
			ok = False
			break
	if ok:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	c = sorted(a)
	x = 0
	for i in range(len(a) - 1):
		if abs(c[i + 1] - c[i]) <= 1:
			x += 1
	if n - x == 1:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	input()
	n = set(map(int, input().split()))
	print('YNEOS'[max(n) - min(n) >= len(n)::2])


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a = sorted(a)
	if len(a) == 1:
		print('YES')
		continue
	else:
		flag = 0
		for i in range(len(a) - 1):
			if abs(a[i] - a[i + 1]) > 1:
				flag = 1
				break
		if flag == 1:
			print('NO')
		else:
			print('YES')


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


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


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	l = list(map(int, sys.stdin.readline().split()))
	l.sort()
	count = 0
	for i in range(n - 1):
		if abs(-l[i] + l[i + 1]) > 1:
			count += 1
	if count < 1:
		print('YES')
	else:
		print('NO')


a = int(input())
while a != 0:
	l = int(input())
	arr = list(map(int, input().strip().split()))
	arr = sorted(arr)
	check = 'YES'
	for i in range(0, l - 1):
		if arr[i + 1] - arr[i] <= 1:
			continue
		else:
			check = 'NO'
			break
	print(check)
	a = a - 1


z = int(input())
for i in range(z):
	n = int(input())
	l = [int(i) for i in input().split()]
	l.sort()
	c = 0
	for i in range(len(l) - 1):
		if abs(l[i] - l[i + 1]) > 1:
			c = c + 1
			break
	if c == 0:
		print('YES')
	else:
		print('NO')


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


def solve():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		i = 0
		end = 0
		while i < len(a) - 1:
			if a[i + 1] - a[i] <= 1:
				i += 1
			else:
				end = 1
				break
		if end:
			print('NO')
		else:
			print('YES')
solve()


from collections import Counter

def main():
	t = int(input())
	for i in range(t):
		a = int(input())
		arr = set(map(int, input().split()))
		arr = sorted(list(arr))
		v = [arr[i + 1] - arr[i] for i in range(len(arr) - 1)]
		res = set(v)
		if len(res) == 0 or (len(res) == 1 and 1 in res):
			print('YES')
		else:
			print('NO')
main()


n = int(input())
A = [[0] * 2 for i in range(n)]
for i in range(n):
	A[i][0] = int(input())
	A[i][1] = list(map(int, input().split()))

def check(A):
	for x in A:
		a = x[1]
		a.sort()
		lens = [a[i + 1] - a[i] for i in range(x[0] - 1) if a[i + 1] - a[i] > 1]
		if lens == []:
			print('YES')
		else:
			print('NO')
check(A)


def ip():
	return int(input())

def sip():
	return input()

def mip():
	return map(int, input().split())

def lip():
	return list(map(int, input().split()))

def matip(n, m):
	lst = []
	for i in range(n):
		arr = lip()
		lst.append(arr)
	return lst
t = ip()
while t:
	t -= 1
	n = ip()
	arr = lip()
	arr.sort()
	flag = 0
	for i in range(1, n):
		if arr[i] - arr[i - 1] > 1:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


n = int(input())
r = []
for i in range(n):
	c = 0
	ln = int(input())
	l = list(map(int, input().split()))
	l.sort()
	for j in range(ln - 1):
		if l[j + 1] - l[j] > 1:
			r.append('NO')
			c = c + 1
			break
	if c == 0:
		r.append('YES')
for i in r:
	print(i)


def fun(b, z):
	if len(b) == 1 or z == len(b):
		return b
	a = len(b)
	z = 1
	for i in range(a - 1):
		if b[i + 1] - b[i] == 1 or b[i + 1] - b[i] == 0:
			b.pop(i)
			return fun(b, z)
		else:
			z = z + 1
	return fun(b, z)
for _ in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	b.sort()
	x = fun(b, 1)
	if len(x) == 1:
		print('YES')
	else:
		print('NO')


from collections import Counter
t = int(input())
count = 0
for _ in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	i = 1
	while i < len(a):
		if abs(a[i - 1] - a[i]) <= 1:
			a.remove(a[i - 1])
		else:
			i += 1
	if len(a) <= 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	list1 = list(map(int, input().split()))
	a = set(list1)
	print('YES' if max(a) - min(a) < len(a) else 'NO')


def main():
	tc = int(input())
	while tc > 0:
		tc = tc - 1
		n = int(input())
		l = map(int, input().split())
		l = sorted(l)
		max_dist = 0
		for i in range(1, n):
			max_dist = max(l[i] - l[i - 1], max_dist)
		if max_dist > 1:
			print('NO')
		else:
			print('YES')
main()


from __future__ import division, print_function
import os, sys
import math
import collections
from itertools import permutations
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

class my_dictionary(dict):

	def __init__(self):
		self = dict()

	def add(self, key, value):
		self[key] = value

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(n - r))

def binary_search(arr, low, high, x):
	if high >= low:
		mid = (high + low) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binary_search(arr, low, mid - 1, x)
		else:
			return binary_search(arr, mid + 1, high, x)
	else:
		return -1

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def padded_bin_with_complement(x):
	if x < 0:
		return bin(2 ** 16 - abs(x))[2:].zfill(16)
	else:
		return bin(x)[2:].zfill(16)

def binaryToDecimal(binary):
	binary1 = binary
	(decimal, i, n) = (0, 0, 0)
	while binary != 0:
		dec = binary % 10
		decimal = decimal + dec * pow(2, i)
		binary = binary // 10
		i += 1
	print(decimal)

def CountFrequency(my_list):
	freq = {}
	for item in my_list:
		if item in freq:
			freq[item] += 1
		else:
			freq[item] = 1
	return freq

def pos(a):
	b = [0] * len(a)
	c = sorted(a)
	for i in range(len(a)):
		for j in range(len(a)):
			if c[j] == a[i]:
				b[i] = j
				break
	return b

def smallestDivisor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i * i <= n:
		if n % i == 0:
			return i
		i += 2
	return n

def commonn(a, b, n):
	c = []
	for i in range(n):
		if a[i] == b[i]:
			c.append('-1')
		else:
			c.append(b[i])
	return c

def primeFactors(n):
	j = []
	while n % 2 == 0:
		j.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			j.append(int(n))
			n = n / i
	if n > 2:
		j.append(int(n))
	return j

def sumdigit(n):
	n = str(n)
	k = 0
	for i in range(len(n)):
		k += int(n[i])
	return k

def question(a, n):
	j = a
	for i in range(n):
		if a[i] == '1':
			j[i] = '0'
		else:
			j[i] = '1'
	j[0, n - 1].reverse()
	return j

def main():
	for _ in range(ii()):
		n = ii()
		a = li()
		a.sort()
		f = 1
		for i in range(n - 1):
			if abs(a[i] - a[i + 1]) > 1:
				f = 0
				break
		if f:
			print('YES')
		else:
			print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


test_case = int(input())
for i in range(test_case):
	len = int(input())
	flag = 0
	values = list(map(int, input().split(' ')))
	values.sort()
	for i in range(len - 1):
		if values[i + 1] - values[i] <= 1:
			flag = 0
		else:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')


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


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


t = int(input())
while t > 0:
	n = int(input())
	arr = list(map(int, input().split(' ')))
	arr.sort()
	ok = True
	for i in range(len(arr)):
		ok = ok and arr[i] - arr[i - 1] <= 1
	if ok:
		print('YES')
	else:
		print('NO')
	t -= 1


testcase = int(input())
for _ in range(testcase):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print('YES')
		continue
	a.sort()
	c = 0
	for i in range(1, n):
		if abs(a[i] - a[i - 1]) > 1:
			print('NO')
			c = 1
			break
	if c == 0:
		print('YES')


import math
m = int(input())
for l in range(m):
	n = int(input())
	arr = list(map(int, input().split()))
	count = 0
	arr.sort()
	for i in range(n):
		for j in range(n):
			if arr[i] == 0:
				break
			if i != j and arr[j] != 0 and (abs(arr[i] - arr[j]) <= 1):
				if arr[i] < arr[j]:
					arr[i] = 0
				else:
					arr[j] = 0
	for i in range(n):
		if arr[i] == 0:
			count += 1
	if count >= n - 1:
		print('YES')
	else:
		print('NO')


for test in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	ans = 'YES'
	for i in range(1, n):
		if abs(arr[i] - arr[i - 1]) > 1:
			ans = 'NO'
			break
	print(ans)


t = int(input())
while t != 0:
	n = int(input())
	l = []
	l = [int(i) for i in input().split()]
	l.sort()
	count = 1
	for _ in range(1, n):
		if l[_ - 1] == l[_] or l[_] - l[_ - 1] == 1:
			count += 1
	if count == n:
		print('YES')
	else:
		print('NO')
	t = t - 1


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


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	m = []
	for k in range(0, len(arr)):
		m.append(arr[k])
	c = 0
	for j in range(0, len(arr) - 1):
		if arr[j + 1] - arr[j] <= 1:
			m.remove(arr[j])
			c += 1
	if len(m) == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	k = input()
	l = list(map(int, input().split(' ')))
	l.sort()
	if len(l) == 1:
		print('YES')
	else:
		flag = 0
		p = l[0]
		for i in range(1, len(l)):
			if l[i] - p != 1 and l[i] - p != 0:
				flag = 1
				break
			p = l[i]
		if flag == 1:
			print('NO')
		else:
			print('YES')


n = int(input())
for i in range(n):
	k = int(input())
	t = [int(x) for x in input().split()]
	answer = 0
	t.sort()
	if len(t) == 1:
		print('YES')
	else:
		for a in range(k - 1):
			if abs(t[a] - t[a + 1]) <= 1:
				answer += 1
		if answer == k - 1:
			print('YES')
		else:
			print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	ar = input().split(' ')
	norepes = 0
	for j in range(n):
		ar[j] = int(ar[j])
	for j in range(n):
		if not ar[j] in ar[0:j]:
			norepes += 1
	if max(ar) - min(ar) == norepes - 1:
		print('YES')
	else:
		print('NO')


t = input()
t = int(t)

def solve():
	n = input()
	n = int(n)
	lst = []
	a = input()
	a = a.split()
	for i in range(0, len(a)):
		lst.append(int(a[i]))
	lst.sort(reverse=True)
	ans = 'YES'
	for i in range(0, n - 1):
		if lst[i] - lst[i + 1] > 1:
			ans = 'NO'
			break
	print(ans)
while t > 0:
	solve()
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) > 1:
			print('NO')
			break
	else:
		print('YES')


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	lst = list(map(int, sys.stdin.readline().split()))
	lst.sort()
	ans = True
	for i in range(1, n):
		if lst[i - 1] != lst[i] and lst[i - 1] + 1 != lst[i]:
			ans = False
			break
	if ans:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	L = list(map(int, input().split()))
	L.sort()
	(i, f) = (0, 1)
	while i < len(L) - 1:
		if L[i] + 1 == L[i + 1] or L[i] == L[i + 1]:
			L.remove(L[i])
		else:
			f = 0
			break
	if f == 1:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	length = int(input())
	numbers = list(map(int, input().split()))
	numbers.sort()
	for i in range(length - 1):
		if abs(numbers[i] - numbers[i + 1]) > 1:
			print('NO')
			break
	else:
		print('YES')


p = int(input())
while p:
	n = int(input())
	a = list(map(int, input().split()))
	s = set(a)
	s = sorted(s)
	s = list(s)
	m = max(a)
	x = 0
	for i in range(len(s) - 1):
		if s[i + 1] - s[i] != 1:
			x = 1
			break
	if x == 0:
		print('YES')
	else:
		print('NO')
	p -= 1


t = int(input())
for i in range(t):
	a = int(input())
	l = [int(i) for i in input().split()]
	i = 1
	ct = 0
	l = sorted(l)
	flag = 0
	for i in range(1, len(l)):
		if abs(l[i] - l[i - 1]) > 1:
			flag = 1
			print('NO')
			break
	if flag == 0:
		print('YES')


n = int(input())
answer = [0] * n
for i in range(n):
	k = int(input())
	a = sorted([int(j) for j in input().split()])
	s = 0
	if k == 1:
		answer[i] = 'YES'
	else:
		for j in range(k - 1):
			s = max(s, a[j + 1] - a[j])
		if s <= 1:
			answer[i] = 'YES'
		else:
			answer[i] = 'NO'
for i in range(n):
	print(answer[i])


t = int(input())
for i in range(t):
	arraylen = int(input())
	array = list(map(int, input().split()))
	array = sorted(array)
	if arraylen == 1:
		print('YES')
	else:
		prev = array[0]
		flag = 1
		for j in range(1, arraylen):
			if array[j] - prev > 1:
				flag = 0
				break
			prev = array[j]
		if flag:
			print('YES')
		else:
			print('NO')


u = int(input())
li = []
for i in range(u):
	b = int(input())
	a = list(map(int, input().split()))
	a.sort()
	for i in range(b - 1):
		if a[i + 1] - a[i] == 0 or a[i + 1] - a[i] == 1:
			continue
		else:
			li.append('NO')
			break
	else:
		li.append('YES')
for i in li:
	print(i)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

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

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect
from collections import deque, defaultdict, OrderedDict
import collections

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(ri()):
		n = ri()
		a = ria()
		a = deque(sorted(a))
		for i in range(n - 1):
			if a[1] - a[0] >= 0 and a[1] - a[0] <= 1:
				a.popleft()
		if len(a) == 1:
			print('YES')
		else:
			print('NO')
			i
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


n = int(input())
for i in range(n):
	k = int(input())
	num = input()
	list = [int(x) for x in num.split()]
	l = []
	a = 0
	for i in list:
		if i not in l:
			l.append(i)
	if len(l) == 1:
		print('YES')
	else:
		for u in l:
			if u + 1 not in l or u - 1 not in l:
				a += 1
		if a > 2:
			print('NO')
		elif a == 2 and len(l) == 2 and (abs(l[0] - l[1]) != 1):
			print('NO')
		else:
			print('YES')


def bubble_sort(a):
	i = len(a) - 1
	while i > 0:
		j = 0
		while j < i:
			if a[j] > a[j + 1]:
				(a[j + 1], a[j]) = (a[j], a[j + 1])
			j += 1
		i -= 1
	return a
t = int(input())
out = []
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	bubble_sort(arr)
	for j in range(len(arr) - 1):
		if arr[j + 1] - arr[j] <= 1:
			arr[j] = -1
	c = 0
	for k in arr:
		if k != -1:
			c += 1
	if c == 1:
		out.append('YES')
	else:
		out.append('NO')
for p in out:
	print(p)


t = int(input())

def f(a):
	a = sorted(a)
	otvet = 'YES'
	for i in range(len(a) - 1):
		if abs(a[i] - a[i + 1]) > 1:
			otvet = 'NO'
	return otvet
for i in range(1, t + 1):
	n = int(input())
	a = [int(x) for x in input().split()]
	print(f(a))


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	flag = 0
	for i in range(n - 1):
		if a[i] == a[i + 1] or a[i] == a[i + 1] - 1:
			continue
		flag = 1
		break
	if flag == 1:
		print('NO')
	else:
		print('YES')


import sys
t = int(input())
while t:
	n = int(input())
	arr = list(map(int, sys.stdin.readline().strip().split()))
	arr.sort()
	stack = []
	for i in range(n):
		if not stack:
			stack.append(arr[i])
		else:
			if arr[i] - stack[-1] <= 1:
				stack.pop()
			stack.append(arr[i])
	if len(stack) == 1:
		print('YES')
	else:
		print('NO')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	arrList = list(map(int, input().split()))
	arrList.sort()
	flag = 1
	for i in range(1, len(arrList)):
		if arrList[i] - arrList[i - 1] <= 1:
			pass
		else:
			flag = 0
	if flag:
		print('YES')
	else:
		print('NO')


def small(ar, n):
	for i in range(1, n):
		if ar[i] - ar[i - 1] > 1:
			return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	print(small(ar, n))


t = int(input())
for i in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	uniques = set()
	maxi = mini = arr[0]
	for i in arr:
		uniques.add(i)
		if i < mini:
			mini = i
		elif i > maxi:
			maxi = i
	if len(uniques) == maxi - mini + 1:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
import math
from collections import defaultdict

def arrinp():
	return [*map(int, stdin.readline().split(' '))]

def mulinp():
	return map(int, stdin.readline().split(' '))

def intinp():
	return int(stdin.readline())

def inp():
	return stdin.readline()

def solution():
	n = intinp()
	a = arrinp()
	a.sort()
	i = 0
	while i < n - 1:
		if a[i + 1] - a[i] < 2:
			i += 1
		else:
			break
	if i == n - 1:
		return 'YES'
	else:
		return 'NO'
testcases = 1
testcases = intinp()
for _ in range(testcases):
	print(solution())


import sys
readline = lambda : sys.stdin.readline().strip('\n')
readgen = lambda : map(int, readline().split())
for _ in range(int(input())):
	n = int(input())
	a = sorted(readgen())
	flag = any([a[i + 1] - a[i] > 1 for i in range(len(a) - 1)])
	print('YNEOS'[flag::2])


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	a = sorted(arr)
	k = True
	for i in range(1, n):
		k &= a[i] - a[i - 1] <= 1
	if k:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	_ = input()
	s = set(map(int, input().split()))
	if s == set(range(min(s), max(s) + 1, 1)):
		print('YES')
	else:
		print('NO')


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


def fun(l):
	if len(l) == 1:
		return 'YES'
	l.sort()
	count = 0
	for i in range(len(l) - 1):
		if abs(l[i] - l[i + 1]) <= 1:
			count += 1
	if count == len(l) - 1:
		return 'YES'
	return 'NO'
n1 = int(input())
for _ in range(n1):
	n2 = int(input())
	l = []
	n3 = input()
	for j in range(n2):
		l.append(int(n3.split()[j]))
	print(fun(l))


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	v = [int(x) for x in input().split()]
	v.sort()
	chained = True
	prev = v[0]
	for elem in v[1:]:
		if abs(elem - prev) > 1:
			chained = False
			break
		else:
			prev = elem
	print(chained and 'YES' or 'NO')


t = int(input())
for j in range(t):
	s = []
	q = True
	a = int(input())
	if a > 1:
		b = input().split(' ')
		b = [int(x) for x in b]
		b.sort()
		for i in range(a - 1):
			if b[i + 1] - b[i] > 1:
				print('NO')
				q = False
				break
	else:
		b = int(input())
	if q:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	lst.sort()
	ans = 1
	for i in range(len(lst) - 1):
		if abs(lst[i] - lst[i + 1]) <= 1:
			continue
		else:
			ans = 0
			break
	if ans == 1:
		print('YES')
	else:
		print('NO')


a = int(input())
for i in range(a):
	x = int(input())
	c = 0
	ar = list(map(int, input().split()))
	ar.sort()
	y = True
	for i in range(1, x):
		y &= ar[i] - ar[i - 1] <= 1
	if y:
		print('YES')
	else:
		print('NO')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	t = I()
	rr = []
	for _ in range(t):
		n = I()
		a = sorted(LI())
		c = 0
		for i in range(n - 1):
			if a[i + 1] - a[i] > 1:
				c += 1
		if c > 0:
			rr.append('NO')
		else:
			rr.append('YES')
	return JA(rr, '\n')
print(main())


t = int(input())
for i in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	found = False
	lst = sorted(lst)
	for j in range(n - 1):
		if abs(lst[j] - lst[j + 1]) > 1:
			found = True
			break
	print('NO') if found else print('YES')


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


test = int(input())
for _ in range(test):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	p1 = 0
	p2 = 1
	while p2 < len(l) and p1 < len(l) and (len(l) > 1):
		if l[p2] - l[p1] <= 1:
			l.pop(p1)
			p1 -= 1
			p2 -= 1
			if p1 < 0:
				p1 = 0
				p2 = p1 + 1
		else:
			p2 += 1
			p1 += 1
	if len(l) == 1:
		print('YES')
	else:
		print('NO')


import sys

def main():
	test_cases = int(sys.stdin.readline())
	for _ in range(test_cases):
		array_length = int(sys.stdin.readline())
		arr = [int(i) for i in sys.stdin.readline().split()]
		arr.sort()
		if any((abs(a - b) > 1 for (a, b) in zip(arr[:-1], arr[1:]))):
			print('NO')
		else:
			print('YES')
main()


n = int(input())
for _ in range(n):
	__ = int(input())
	ls = sorted(list(map(int, input().split())))
	while True:
		if len(ls) > 1:
			if ls[1] - ls[0] <= 1:
				del ls[0]
			else:
				break
		else:
			break
	if len(set(ls)) <= 1:
		print('YES')
	else:
		print('NO')


def solution(A, n):
	A = sorted(A)
	for (a, b) in zip(A, A[1:]):
		if abs(a - b) > 1:
			return False
	return True
t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split(' ')))
	if solution(A, n):
		print('YES')
	else:
		print('NO')


n = int(input())

def arr(x1):
	x1 = sorted(x1)
	if len(x1) > 1:
		for j in range(0, len(x1) - 1):
			if abs(x1[j] - x1[j + 1]) <= 1:
				return arr(x1[1:])
			else:
				print('NO')
				break
	if len(x1) == 1:
		print('YES')
while n:
	m = int(input())
	l1 = []
	l1 = input().split(' ')
	l1 = [int(i) for i in l1]
	arr(l1)
	n = n - 1


tests = int(input())
for _ in range(tests):
	n = int(input())
	num = list(map(int, input().split()))
	num.sort()
	for i in range(1, n):
		if num[i] - num[i - 1] > 1:
			print('NO')
			break
	else:
		print('YES')


for t in range(int(input())):
	n = int(input())
	a = [int(j) for j in input().split()]
	z = 0
	a.sort()
	for i in range(1, len(a)):
		if abs(a[i] - a[i - 1]) > 1:
			z = 1
			break
	if z == 0:
		print('YES')
		continue
	print('NO')


n = int(input())
for i in range(n):
	num = int(input())
	l = input().split()
	s = set(l)
	l2 = list(s)
	l2 = [int(x) for x in l2]
	l2.sort()
	if l2[-1] - l2[0] >= len(l2):
		print('NO')
	else:
		print('YES')


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


for case in range(int(input())):
	n = int(input())
	a = sorted(map(int, input().split()))
	pre = -1
	ans = 'YES'
	for x in a:
		if pre != -1 and x - pre > 1:
			ans = 'NO'
		pre = x
	print(ans)


n = int(input())
for i in range(n):
	n1 = int(input())
	arr = [int(n) for n in input().split()]
	if n1 == 1:
		print('YES')
		continue
	notone = True
	arr.sort()
	for i in range(1, n1):
		if arr[i] - arr[i - 1] > 1:
			print('NO')
			notone = False
			break
	if notone:
		print('YES')


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


import sys

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 19
MOD = 10 ** 9 + 7
for _ in range(INT()):
	N = INT()
	A = LIST()
	A.sort()
	for i in range(N - 1):
		if A[i + 1] - A[i] > 1:
			NO()
			break
	else:
		YES()


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


n_test = int(input())
for _ in range(n_test):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 'YES'
	for i in range(1, len(a)):
		if a[i] - a[i - 1] > 1:
			ans = 'NO'
	print(ans)


t = int(input())
res = [1 for i in range(t)]
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	if len(a) == 1:
		res[i] = 1
	else:
		for j in range(1, n):
			if abs(a[j] - a[j - 1]) > 1:
				res[i] = res[i] * 0
			else:
				res[i] = res[i] * 1
for i in range(t):
	if res[i] == 1:
		print('YES')
	else:
		print('NO')


T = int(input())
while T != 0:
	n = int(input())
	a = list(map(int, input().strip().split()))[:n]
	a.sort()
	possible = True
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			possible = False
			break
	if possible:
		print('YES')
	else:
		print('NO')
	T -= 1


def sol(nums):
	for i in range(len(nums) - 1):
		if 1 < nums[i + 1] - nums[i]:
			return 'NO'
	return 'YES'
cases = input()
for i in range(int(cases)):
	input()
	nums = [int(x) for x in input().split()]
	print(sol(sorted(nums)))


z = int(input())
for y in range(z):
	x = int(input())
	ans = 'YES'
	arr = list(map(int, input().split()))
	arr.sort()
	while len(arr) > 1:
		if arr[1] - arr[0] <= 1:
			arr.remove(arr[0])
		else:
			ans = 'NO'
			break
	print(ans)


for p in range(int(input())):
	k = int(input())
	l = list(map(int, input().split()))
	l.sort()
	j = 0
	while j < k and len(l) != 1:
		for i in range(k - 1):
			if abs(l[i:i + 2][0] - l[i:i + 2][1]) <= 1:
				l.remove(min(l[i:i + 2]))
				j = 0
				k -= 1
				break
			else:
				j += 1
	if len(l) == 1:
		print('YES')
	else:
		print('NO')


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


t = int(input())
res = []
for i in range(t):
	n = int(input())
	sonlar = []
	s = input().split()
	for j in s:
		sonlar.append(int(j))
	sonlar.sort()
	shart = True
	for j in range(n - 1):
		if sonlar[j + 1] - sonlar[j] > 1:
			res.append('NO')
			shart = False
			break
	if shart:
		res.append('YES')
for i in res:
	print(i)


def can_form(n, a):
	if n == 1:
		return 'YES'
	l = sorted(a)
	d = []
	for i in range(n - 1):
		d.append(l[i + 1] - l[i])
	m = max(d)
	if m <= 1:
		return 'YES'
	else:
		return 'NO'
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(can_form(n, a))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	if len(a) == 1:
		print('YES')
	else:
		i = 0
		j = 1
		c = True
		while len(a) > 1:
			if a[j] - a[i] <= 1:
				a.remove(a[i])
			else:
				c = False
				break
		if c is False:
			print('NO')
		else:
			print('YES')


test = int(input())
for t in range(test):
	arrLength = int(input())
	arr = input().split(' ')
	for i in range(0, len(arr)):
		arr[i] = int(arr[i])
	arr.sort()
	i = 0
	while i < len(arr) - 1:
		arrLength = len(arr)
		for j in range(i + 1, len(arr)):
			if abs(arr[i] - arr[j]) <= 1:
				arr.pop(i)
				break
		if arrLength == len(arr):
			i += 1
	if len(arr) == 1:
		print('YES')
	else:
		print('NO')


test_case_number = int(input())
for _ in range(test_case_number):
	liste_length = int(input())
	liste = sorted([int(number) for number in input().split()])
	diff = [a - b for (a, b) in zip(liste[1:], liste[:-1])]
	if liste_length == 1 or max(diff) < 2:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	rL = int(input())
	List = list(map(int, input().split()))
	List.sort()
	a = 'YES'
	for j in range(rL - 1):
		if List[j + 1] - List[j] > 1:
			a = 'NO'
			break
	print(a)


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	li.sort()
	p = 0
	if n == 1:
		print('YES')
	else:
		for i in range(len(li) - 1):
			if li[i + 1] - li[i] == 1 or li[i + 1] - li[i] == 0:
				c = 1
			else:
				p = 1
				break
		if p == 1:
			print('NO')
		else:
			print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().strip().split()[:n]))
	c = 0
	l.sort()
	while c != n - 1:
		for i in range(1, len(l)):
			if abs(l[i - 1] - l[i]) <= 1:
				a = min(l[i - 1], l[i])
				l.remove(a)
				break
		c = c + 1
	if len(l) == 1:
		print('YES')
	else:
		print('NO')


def find(l, li):
	li.sort()
	if l == 1:
		return 1
	stack = []
	for i in li:
		if len(stack) == 0:
			stack.append(i)
		elif stack[-1] == i:
			stack.pop()
			stack.append(i)
		elif abs(stack[-1] - i) == 1:
			stack.pop()
			stack.append(i)
		else:
			stack.append(i)
	if len(stack) == 1:
		return 1
	else:
		return 0
n = int(input())
for i in range(0, n):
	l = int(input())
	li = list(map(int, input().split()))
	if find(l, li):
		print('YES')
	else:
		print('NO')


from functools import reduce
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def inn():
	return int(input())
t = inn()
while t:
	t -= 1
	n = inn()
	a = arr()
	a.sort()
	flag = 0
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


for _a in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	lis = sorted(lis)
	res = True
	while len(lis) > 1:
		if abs(lis[1] - lis[0]) > 1:
			res = False
			break
		else:
			if lis[1] >= lis[0]:
				lis = lis[1:]
			else:
				lis = lis[:1] + lis[2:]
			lis = sorted(lis)
	if res == True:
		print('YES')
	else:
		print('NO')


def main():
	t = int(input())
	for case in range(t):
		n = int(input())
		a = [int(x) for x in input().split()]
		a = sorted(a)
		flag = True
		while len(a) > 1:
			if a[1] - a[0] > 1:
				print('NO')
				flag = False
				break
			else:
				a.pop(0)
		if flag:
			print('YES')
main()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	flag = 0
	i = 0
	while i != len(a) - 1 and flag < 1:
		if abs(a[i] - a[i + 1]) <= 1:
			a.pop(0)
		else:
			i += 1
			flag += 1
	if flag >= 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	if n == 1:
		print('YES')
	else:
		arr = sorted(arr)
		(i, f) = (0, True)
		while i < n - 1:
			if arr[i + 1] - arr[i] > 1:
				f = False
				break
			i += 1
		print('YES' if f == True else 'NO')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	i = 0
	while i < n - 1:
		if abs(arr[i] - arr[i + 1]) in (0, 1):
			arr.remove(min(arr[i], arr[i + 1]))
			n -= 1
		else:
			i += 1
	if n == 1:
		print('YES')
	else:
		print('NO')


tc = int(input())
for _ in range(tc):
	n = int(input())
	arr = list(map(int, input().split()))
	flag = 1
	arr.sort()
	for i in range(1, n):
		if abs(arr[i] - arr[i - 1]) > 1:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


def solve():
	N = int(input())
	A = sorted(list(map(int, input().split())))
	for i in range(N):
		if A[i] - A[i - 1] > 1:
			print('NO')
			return
	print('YES')
	return
Testcase = 1
Testcase = int(input())
for _ in range(Testcase):
	solve()


import os
import heapq
import sys
import math
import operator
from collections import defaultdict
from io import BytesIO, IOBase

def inpt():
	return [int(k) for k in input().split()]

def main():
	for _ in range(int(input())):
		n = int(input())
		ar = inpt()
		ar = list(set(ar))
		ar.sort()
		ok = True
		for i in range(len(ar) - 1):
			if ar[i + 1] - ar[i] > 1:
				ok = False
				break
		if ok:
			print('YES')
		else:
			print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr = sorted(arr, reverse=True)
	if n == 1:
		print('YES')
	else:
		f = all((arr[i] - arr[i + 1] <= 1 for i in range(n - 1)))
		if f:
			print('YES')
		else:
			print('NO')


def can(A, n):
	inf = 9999999999999999999999999
	for i in range(n):
		for j in range(n):
			if A[i] < inf and A[j] < inf:
				if i != j and (A[i] - A[j] == 1 or A[i] == A[j]):
					A[j] += inf
				elif i != j and (A[j] - A[i] == 1 or A[j] == A[i]):
					A[i] += inf
	A.sort()
	if len(A) != 1 and A[1] < inf:
		x = 'NO'
	else:
		x = 'YES'
	return x
t = int(input())
for i in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	print(can(A, n))


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


for _ in range(int(input())):
	input()
	l = list(map(int, input().split()))
	l.sort()
	b = True
	for i in range(1, len(l)):
		if abs(l[i] - l[i - 1]) > 1:
			b = False
			break
	print('YES') if b else print('NO')


import sys, heapq

def get_ints():
	return map(int, I().split())

def get_list():
	return list(map(int, I().split()))

def I():
	return sys.stdin.readline().strip()
for t in range(int(I())):
	n = int(I())
	L = sorted(get_list())
	flag = True
	for i in range(n - 1):
		if abs(L[i] - L[i + 1]) <= 1:
			continue
		else:
			flag = False
			break
	print('YES' if flag else 'NO')


t = input()
t = int(t)
l = [input() for i in range(2 * t)]
for i in range(0, 2 * t, 2):
	l[i] = int(l[i])
	l[i + 1] = l[i + 1].split()
	for j in range(l[i]):
		l[i + 1][j] = int(l[i + 1][j])
	l[i + 1].sort()
for i in range(0, 2 * t, 2):
	x = 0
	while x < l[i] - 1 and l[i] != 1:
		if l[i + 1][x] == l[i + 1][x + 1] or l[i + 1][x] == l[i + 1][x + 1] - 1:
			l[i + 1].pop(x)
			l[i] -= 1
		else:
			x = l[i]
	if l[i] == 1:
		print('YES')
	else:
		print('NO')


def remove_smallest(n, array):
	if n == 1:
		return 'YES'
	else:
		array.sort()
		for i in range(n - 1):
			if array[i + 1] - array[i] > 1:
				return 'NO'
		return 'YES'
t = int(input())
array = []
for i in range(t):
	a = int(input())
	b = list(map(int, input().split(' ')))
	array.append([a, b])
for x in array:
	print(remove_smallest(*x))


def solve(a):
	a.sort()
	k = 0
	for i in range(len(a) - 1):
		if a[i + 1] - a[i] <= 1:
			k += 1
		else:
			break
	return 'YES' if len(a) - k == 1 else 'NO'
n = int(input())
arrays = []
for _ in range(n):
	input()
	arrays.append(list(map(int, input().split())))
for i in range(n):
	print(solve(arrays[i]))


def solve():
	t = int(input())
	for i in range(t):
		n = int(input())
		m = sorted([int(s) for s in input().split()])
		usl = True
		for j in range(1, n):
			if m[j] - m[j - 1] > 1:
				usl = False
		if usl:
			print('YES')
		else:
			print('NO')
solve()


t = int(input())
g = True
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	if len(a) > 1:
		while len(a) > 1 and g:
			if abs(a[1] - a[0]) <= 1:
				a.pop(0)
				g = True
			else:
				print('NO')
				g = False
		if g:
			print('YES')
		g = True
	else:
		print('YES')


def main():
	t = int(input())
	for _ in range(t):
		c = 0
		n = int(input())
		a = [int(i) for i in input().split()]
		a.sort()
		for i in range(1, n):
			if a[i] - a[i - 1] > 1:
				c = 1
				print('NO')
				break
		if c == 0:
			print('YES')
main()


T = int(input())
res = list()
for _ in range(T):
	n = int(input())
	x = list(map(int, input().split()))
	if len(x) == 1:
		res.append('YES')
		continue
	x.sort()
	i = 0
	while i < len(x) - 1:
		j = i + 1
		while j < len(x):
			if abs(x[i] - x[j]) <= 1:
				x.pop(x.index(min(x[i], x[j])))
				j -= 1
			j += 1
		i += 1
	if len(x) == 1:
		res.append('YES')
	else:
		res.append('NO')
for i in range(len(res)):
	print(res[i])


t = int(input(''))
arr = []
for i in range(t):
	input('')
	arr.append(list(map(int, input().split())))
for i in arr:
	i.sort()
	flag = 0
	for j in range(len(i) - 1):
		if abs(i[j + 1] - i[j]) > 1:
			flag = 1
			break
	if flag:
		print('NO')
	else:
		print('YES')


t = int(input())
while t > 0:
	n = int(input())
	arr = list(map(int, input().strip().split()))
	items = set()
	for item in arr:
		items.add(item)
	items = list(items)
	items.sort()
	answer = True
	for pair in zip(items, items[1:]):
		if abs(pair[0] - pair[1]) > 1:
			answer = False
			break
	if answer:
		print('YES')
	else:
		print('NO')
	t -= 1


import os
import heapq
import sys, threading
import math
import bisect
import operator
from collections import defaultdict
sys.setrecursionlimit(10 ** 5)
from io import BytesIO, IOBase

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

def power(x, p, m):
	res = 1
	while p:
		if p & 1:
			res = res * x % m
		x = x * x % m
		p >>= 1
	return res

def inar():
	return [int(k) for k in input().split()]

def lcm(num1, num2):
	return num1 * num2 // gcd(num1, num2)

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		arr = inar()
		lis = []
		counter = 0
		for i in range(n):
			if arr[i] not in lis:
				lis.append(arr[i])
		lis.sort()
		if len(lis) == 1:
			print('YES')
			continue
		for i in range(1, len(lis)):
			if lis[i] - lis[i - 1] > 1:
				counter = 1
				break
		if counter:
			print('NO')
		else:
			print('YES')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import math
t = int(input())
for j in range(t):
	n = int(input())
	arr = [int(i) for i in input().strip().split()]
	arr.sort()
	for i in range(len(arr) - 1):
		if abs(arr[i + 1] - arr[i]) <= 1:
			continue
		else:
			print('NO')
			break
	else:
		print('YES')


def func(a, arr):
	arr.sort()
	for i in range(1, a):
		if abs(arr[i] - arr[i - 1]) > 1:
			print('NO')
			return
	print('YES')
t = int(input())
for _ in range(t):
	a = int(input())
	arr = list(map(int, input().split()))
	func(a, arr)


t = int(input())
while t:
	n = int(input())
	nl = list(map(int, input().split()))
	nl.sort()
	flag = True
	for i in range(n - 1):
		if abs(nl[i] - nl[i + 1]) > 1:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')
	t -= 1


T = int(input())
for z in range(T):
	N = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	l = len(a)
	control = 1
	for i in range(l - 1):
		if a[i + 1] - a[i] > 1:
			print('NO')
			control = 0
			break
	if control == 1:
		print('YES')


tests = int(input())
for _ in range(tests):
	size = int(input())
	nums = list(map(int, input().split()))
	nums.sort()
	found = False
	for i in range(1, size):
		if nums[i] - nums[i - 1] > 1:
			found = True
			break
	if found:
		print('NO')
	else:
		print('YES')


def read_nums():
	return [int(x) for x in input().split()]

def solve():
	(n,) = read_nums()
	nums = sorted(read_nums())
	for i in range(n - 1):
		if abs(nums[i + 1] - nums[i]) > 1:
			print('NO')
			return
	print('YES')

def main():
	(t,) = read_nums()
	for _ in range(t):
		solve()
main()


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	n = int(input())
	A = sorted(map(int, input().split()))
	for i in range(1, n):
		if A[i] > A[i - 1] + 1:
			print('NO')
			break
	else:
		print('YES')


o = int(input())
m = 0
for i in range(o):
	a = int(input())
	b = list(map(int, input().split()))
	b.sort()
	while len(b) != 1:
		if b[0] - b[1] == 1 or b[1] - b[0] == 1 or b[0] - b[1] == 0 or (b[1] - b[0] == 0):
			b.remove(b[0])
		else:
			print('NO')
			m = 1
			break
	if m != 1:
		print('YES')
	m = 0


t = int(input())
while t > 0:
	n = int(input())
	ar = list(map(int, input().split(' ')))
	ar.sort()
	r = 'YES'
	for i in range(n - 1):
		if abs(ar[i + 1] - ar[i]) > 1:
			r = 'NO'
	print(r)
	t -= 1


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


from array import array

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
from random import randint

def qsort(array, n):
	for i in range(1, n):
		key_item = array[i]
		j = i - 1
		while j >= 0 and array[j] > key_item:
			array[j + 1] = array[j]
			j -= 1
		array[j + 1] = key_item
	return array

def sorted(a, n):
	x = 1
	while x < n:
		if a[i - 1] > a[i]:
			return qsort(a, n)
	return a
while True:
	try:
		n = inp()
		i = 0
		while i < n:
			m = inp()
			a = inlt()
			b = qsort(a, m)
			y = 1
			flag = 0
			while y < m:
				if b[y] - b[y - 1] > 1:
					print('NO')
					flag = 1
					break
				y = y + 1
			if flag == 0:
				print('YES')
			i = i + 1
	except EOFError:
		break


n = int(input())
a = []
f = 0
g = []
for i in range(n):
	k = int(input())
	a = input().split(maxsplit=k)
	a = [int(item) for item in a]
	a.sort()
	if len(a) > 1:
		for x in range(1, k):
			if a[x] - a[x - 1] == 1 or a[x] - a[x - 1] == 0:
				f = f + 1
		if k - f == 1:
			g.append('YES')
		else:
			g.append('NO')
	else:
		g.append('YES')
	f = 0
print(*g, sep='\n')


t = int(input())
while t > 0:
	n = int(input())
	l = list(map(int, input().split()))
	l = set(l)
	ans = 0
	l = sorted(l)
	for i in range(1, len(l)):
		if l[i] - l[i - 1] != 1:
			ans = 1
	if ans == 1:
		print('NO')
	else:
		print('YES')
	t -= 1


T = int(input())
for i in range(T):
	n = int(input())
	l = list(map(int, input().split(' ')))
	l.sort()
	a = 1
	p = l[-1]
	for i in range(len(l) - 2, -1, -1):
		if abs(p - l[i]) <= 1:
			l.remove(p)
			p = l[i]
		else:
			print('NO')
			a = 0
			break
	if a and len(l) == 1:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	m = min(a)
	M = max(a)
	s = set(a)
	flag = True
	for i in range(m, M + 1):
		if i in s:
			continue
		else:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


test_case = int(input())
for i in range(test_case):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	arr.sort()
	while arr:
		c = arr.count(arr[0])
		if c == len(arr):
			print('YES')
			break
		elif len(arr) == 1:
			print('YES')
			break
		elif abs(arr[0] - arr[1]) < 2:
			x = min(arr[0], arr[1])
			arr.pop(0)
		else:
			print('NO')
			break


t = int(input())
n = 0
inp = list()
data = list()
for i in range(t):
	n = int(input())
	inp = sorted(list(map(int, input().split())), reverse=True)
	if len(inp) > 1:
		while len(inp) > 1:
			if inp[0] - inp[1] <= 1:
				inp.pop(0)
				if len(inp) == 1:
					print('YES')
					break
			else:
				print('NO')
				break
	else:
		print('YES')
	inp.clear()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	j = 0
	p = 0
	for j in range(n - 1):
		if abs(l[j + 1] - l[j]) <= 1:
			continue
		else:
			p = 1
			break
	if p == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	A = sorted([int(_) for _ in input().split()])
	for _ in range(1, n):
		if A[_] - A[_ - 1] > 1:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	mini = min(l)
	maxi = max(l)
	lc = set(list(range(mini, maxi + 1)))
	for i in l:
		if i in lc:
			lc.remove(i)
	if len(lc) == 0:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
from sys import maxsize
input = stdin.readline

def solve():
	pass
test = 1
test = int(input().strip())
for t in range(0, test):
	n = int(input().strip())
	a = [int(x) for x in input().strip().split()]
	d = {}
	for el in a:
		d[el] = d.get(el, 0) + 1
	d = list(d)
	d.sort()
	flag = True
	for i in range(1, len(d)):
		if d[i] - d[i - 1] != 1:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')
	ans = solve()


x = int(input())
for z in range(x):
	n = int(input())
	l = list(map(int, input().split()))
	f = 0
	c = min(l)
	for i in range(n):
		if l[i] - 1 not in l and l[i] != c:
			print('NO')
			f = 1
			break
	if f == 0:
		print('YES')


n = int(input())

def solve(arr):
	s = sorted(set(arr))
	count = 0
	for (i, v) in enumerate(s[:-1]):
		if v + 1 == s[i + 1]:
			count = count + 1
	if len(s) - count > 1:
		print('NO')
	else:
		print('YES')
while n:
	t = int(input())
	arr = map(int, input().split())
	solve(arr)
	n = n - 1


t = int(input())
for _ in range(t):
	a = int(input())
	A = sorted(list(map(int, input().split())))
	cnt = 0
	for (x, y) in zip(A, A[1:]):
		if abs(x - y) > 1:
			cnt += 1
	if cnt > 0:
		print('NO')
	else:
		print('YES')


for q in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	res = 'YES'
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			res = 'NO'
	print(res)


t = int(input())
while t:
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	found = True
	for i in range(0, len(arr) - 1):
		if arr[i + 1] - arr[i] <= 1:
			continue
		else:
			found = False
	if found:
		print('YES')
	else:
		print('NO')
	t -= 1


t = input()
t = int(t)
while t > 0:
	n = int(input())
	a = list(map(int, input().strip().split()))[:n]
	a.sort()
	flag = 0
	for (idx, val) in enumerate(a[:n - 1]):
		if a[idx + 1] - a[idx] >= 2:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')
	t -= 1


t = int(input())
res = []
for i in range(t):
	n = int(input())
	a = sorted([int(x) for x in input().strip().split(' ')])
	yes = True
	solution = set()
	for j in range(n):
		if not solution:
			solution.add(a[j])
		elif a[j] - 1 in solution:
			solution.remove(a[j] - 1)
			if a[j] + 1 not in solution:
				solution.add(a[j])
		elif a[j] + 1 in solution:
			continue
		else:
			solution.add(a[j])
	if solution and len(solution) == 1:
		res.append('YES')
	else:
		res.append('NO')
print('\n'.join(res))


def soln():
	n = int(input())
	arr = list(map(int, input().split()))
	if n == 1:
		return 'YES'
	arr = sorted(arr)
	past = arr[0]
	for i in range(1, n):
		if arr[i] - past > 1:
			return 'NO'
		past = arr[i]
	return 'YES'
for i in range(int(input())):
	print(soln())


t = int(input())
for _ in range(0, t):
	n = int(input())
	aa = [int(i) for i in input().split()]
	aa.sort()
	if n == 1:
		print('YES')
	else:
		ans = 1
		for i in range(1, n):
			if aa[i] - aa[i - 1] > 1:
				ans = 0
				break
		print(['NO', 'YES'][ans])


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	l = []
	a.sort()
	for i in range(n - 1):
		l.append(abs(a[i] - a[i + 1]))
	var = len(l)
	c = 0
	for i in range(len(l)):
		if l[i] > 1:
			f = 0
			break
		else:
			c += 1
	if c == var:
		print('YES')
	else:
		print('NO')


def f(a):
	if len(a) != 1:
		a.sort()
	n = len(a) - 1
	while n != 0:
		if abs(a[1] - a[0]) <= 1:
			a = a[1:]
			n -= 1
		else:
			return 'NO'
	return 'YES'
results = []
n = int(input())
for num in range(n):
	t = int(input())
	arr = input()
	if len(arr) != 1:
		a = [int(x) for x in arr.split()]
		o = f(a)
		results.append(o)
	else:
		results.append('YES')
for elem in results:
	print(elem)


from fractions import Fraction
from collections import defaultdict
import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
t = int(input())
for _ in range(t):
	n = int(input())
	l = list([int(x) for x in input().split()])
	pos = 0
	f = 0
	l.sort()
	while pos < len(l) - 1:
		if abs(l[pos] - l[pos + 1]) > 1:
			f = 1
			break
		pos += 1
	if f == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	n = int(input())
	ar = list(map(int, input().split()))
	if len(set(ar)) == 1:
		print('YES')
	else:
		yep = 1
		temp = list(set(ar))
		temp.sort()
		for i in range(0, len(temp) - 1):
			if abs(temp[i] - temp[i + 1]) != 1:
				yep = 0
				break
		if yep == 1:
			print('YES')
		else:
			print('NO')
	t -= 1


def del_one(a):
	for i in range(len(a) - 1):
		if a[i + 1] - a[i] == 1:
			del a[i]
			return

def main():
	amount_of_tests = int(input())
	for _ in range(amount_of_tests):
		n = int(input())
		bad_guys = []
		a = [int(i) for i in input().split()]
		a = list(set(a))
		a.sort()
		while len(a) > 1:
			old_len = len(a)
			del_one(a)
			if old_len == len(a):
				print('NO')
				break
		else:
			print('YES')
main()


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


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


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


import sys
for _ in range(int(sys.stdin.readline().rstrip())):
	n = int(sys.stdin.readline().rstrip())
	a = list(map(int, sys.stdin.readline().rstrip().split()))
	a.sort()
	re = 'YES'
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			re = 'NO'
			break
	print(re)


def removeSmallest(arr):
	arr = sorted(arr)
	for i in range(len(arr) - 1):
		if arr[i + 1] - arr[i] > 1:
			return 'NO'
	return 'YES'
n = int(input())
for i in range(n):
	k = int(input())
	arr = [int(x) for x in input().split()]
	print(removeSmallest(arr))


for _ in range(int(input())):
	a = int(input())
	n = list(map(int, input().split()))
	n = sorted(n)
	while True:
		yn = 0
		for (k, i) in enumerate(range(len(n) - 1)):
			if -1 <= n[i] - n[i + 1] <= 1:
				n.remove(n[k])
				yn += 1
				break
		if yn == 0:
			break
	if len(n) == 1:
		print('YES')
	else:
		print('NO')


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


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	last = a[0]
	flag = 0
	for el in a[1:]:
		if last <= el and el - last <= 1:
			last = el
		else:
			flag = 1
			break
	print('YES' if flag == 0 else 'NO')


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
from decimal import Decimal
mod = pow(10, 9) + 7
mod2 = 998244353

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

def out(var, end='\n'):
	sys.stdout.write(str(var) + end)

def outa(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	n = int(data())
	arr = l()
	r = True
	arr.sort()
	for i in range(1, n):
		if arr[i] - arr[i - 1] > 1:
			r = False
			break
	out(('YES', 'NO')[r == False])


def remove_smallest():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = [int(x) for x in input().split()]
		a = sorted(a)
		is_good = True
		for i in range(1, len(a)):
			if abs(a[i] - a[i - 1]) > 1:
				is_good = False
				break
		if is_good:
			print('YES')
		else:
			print('NO')
remove_smallest()


import sys
input = sys.stdin.readline
n = int(input())
ans = 0
for i in range(n):
	(m, l) = (int(input()), list(map(int, input().split())))
	l.sort()
	ans = True
	for i in range(len(l) - 1):
		if abs(l[i + 1] - l[i]) > 1:
			print('NO')
			ans = False
			break
	if ans:
		print('YES')


from collections import deque
from collections import OrderedDict
import math
import sys
import os
import threading
import bisect
import operator
import heapq
from atexit import register
from io import BytesIO
import io
input = lambda : sys.stdin.readline().rstrip('\r\n')

def binary_rep(n):
	l = []
	while n > 0:
		l.append(n % 2)
		n = n // 2
	return l
for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	answer = 'YES'
	for i in range(n - 1):
		if ar[i + 1] - ar[i] > 1:
			answer = 'NO'
			break
	print(answer)


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

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


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


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	p = a[0]
	nn = True
	for i in a:
		if abs(i - p) > 1:
			print('NO')
			nn = False
			break
		p = i
	if nn:
		print('YES')


def run():
	n = int(input())
	nums = [int(i) for i in input().split()]
	nums.sort()
	for i in range(1, n):
		if nums[i] > nums[i - 1] + 1:
			print('NO')
			return
	print('YES')
	return
t = int(input())
for i in range(t):
	run()


t = int(input())
for i in range(t):
	l = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	f = True
	for i in range(l - 1):
		if abs(a[i + 1] - a[i]) > 1:
			f = False
			break
	if f:
		print('YES')
	else:
		print('NO')


n = int(input())
numbers = []
for i in range(n):
	input()
	temp = list(map(int, input().split()))
	temp.sort()
	numbers.append(temp)
for numberList in numbers:
	val = True
	for i in range(1, len(numberList)):
		if numberList[i] - numberList[i - int(1)] > int(1):
			val = False
	if val:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = set(a)
	if len(s) == max(s) - min(s) + 1:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	c = 0
	m = input()
	m = int(m)
	k = input().split()
	if len(k) == 1:
		print('YES')
	else:
		for j in range(m):
			k[j] = int(k[j])
		k.sort()
		for p in range(m - 1):
			if k[p + 1] - k[p] > 1 and c == 0:
				print('NO')
				c += 1
				break
		if c == 0:
			print('YES')


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


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print('YES')
	else:
		a.sort()
		maxd = -1
		for i in range(n - 1):
			maxd = max(maxd, a[i + 1] - a[i])
		if maxd >= 2:
			print('NO')
		else:
			print('YES')


import sys
INP = lambda : sys.stdin.readline().strip()
INT = lambda : int(INP())
MAP = lambda : map(int, INP().split())
ARR = lambda : [int(i) for i in INP().split()]

def JOIN(arr, x=' '):
	return x.join([str(i) for i in arr])

def EXIT(x='NO'):
	print(x)
	exit()
for _ in range(INT()):
	n = INT()
	arr = sorted(ARR())
	ans = 'YES'
	for i in range(1, n):
		if arr[i] - arr[i - 1] > 1:
			ans = 'NO'
			break
	print(ans)


t = int(input())
for _ in range(t):
	length_of_ls = int(input())
	ls = list(map(int, input().split()))
	if len(ls) == 1:
		print('YES')
	else:
		ls.sort()
		for i in range(1, len(ls)):
			if -1 <= ls[0] - ls[1] <= 1:
				ls.pop(0)
		if len(ls) == 1:
			print('YES')
		else:
			print('NO')


import math
from sys import stdin, stdout
from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	f = 0
	for i in range(n - 1):
		if l[i + 1] - l[i] > 1:
			f = 1
			print('NO')
			break
	if f == 0:
		print('YES')


try:
	for test in range(int(input())):
		size = int(input())
		arr = list(map(int, input().split()))
		arr.sort()
		(i, j) = (0, 1)
		while j < len(arr):
			if arr[j] - arr[i] <= 1:
				i += 1
				j += 1
			else:
				break
		if i == len(arr) - 1:
			print('YES')
		else:
			print('NO')
except:
	pass


t = int(input())
for x in range(t):
	n = int(input())
	a = input().split()
	for j in range(n):
		a[j] = int(a[j])
	check = True
	a.sort()
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			check = False
	if check:
		print('YES')
	else:
		print('NO')


sets = int(input())
glod_counter = 0
while glod_counter < sets:
	len_o_list = int(input())
	data = list(map(int, input().split()))
	data = sorted(data)
	for i in range(1, len_o_list):
		if data[i] - data[i - 1] <= 1 or data[i] == data[i - 1]:
			continue
		else:
			print('NO')
			break
	else:
		print('YES')
	glod_counter += 1


for _ in range(int(input())):
	n = int(input())
	k = 1
	lis = list(map(int, input().split()))
	lis.sort()
	for i in range(1, n):
		if lis[i] - lis[i - 1] <= 1:
			pass
		else:
			k = 0
			break
	if k:
		print('YES')
	else:
		print('NO')


def removeSmallest(a):
	if len(a) == 1:
		return 'YES'
	else:
		a.sort()
		for i in range(1, len(a)):
			if a[i] - a[i - 1] > 1:
				return 'NO'
		return 'YES'
n = int(input())
for i in range(n):
	k = int(input())
	l = list(map(int, input().split()))
	print(removeSmallest(l))


k = int(input())
for _ in range(k):
	k_el = int(input())
	data = sorted(set(map(int, input().split())))
	k = None
	fl = True
	for n in data:
		if k is None:
			k = n + 1
		elif n == k:
			k += 1
		else:
			fl = False
			print('NO')
			break
	if fl is True:
		print('YES')


def main():
	T = int(input())
	for _ in range(T):
		N = int(input())
		A = [int(i) for i in input().split()]
		A.sort()
		if N == 1 or all((A[i + 1] - A[i] <= 1 for i in range(N - 1))):
			print('YES')
		else:
			print('NO')
main()


Q = int(input())
for i in range(Q):
	N = int(input())
	L = list(map(int, input().split()))
	L.sort()
	flag = 0
	for i in range(1, N):
		if L[i] - L[i - 1] > 1:
			flag = 1
	if flag == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	ans = 'YES'
	string = [int(i) for i in input().split()]
	string.sort()
	prev = string.pop(0)
	for i in string:
		if i - prev > 1:
			ans = 'NO'
			break
		prev = i
	print(ans)


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


t = int(input())
for q in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	x = n
	i = 0
	while i < n - 1:
		if arr[i] == arr[i + 1] or arr[i] + 1 == arr[i + 1]:
			x -= 1
		i += 1
	if x == 1:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from functools import lru_cache
import math
rl = lambda : stdin.readline()
rll = lambda : stdin.readline().split()
rli = lambda : map(int, stdin.readline().split())
rlf = lambda : map(float, stdin.readline().split())
(INF, NINF) = (float('inf'), float('-inf'))
MOD = 10 ** 9 + 7

def main():
	T = int(rl())
	for _ in range(T):
		n = int(rl())
		A = list(rli())
		A.sort()
		flag = False
		for i in range(1, len(A)):
			if A[i] - A[i - 1] > 1:
				flag = True
				break
		print('NO' if flag else 'YES')
	stdout.close()
main()


def solve():
	n = int(input())
	nums = sorted(list(map(int, input().split())))
	last = nums[0]
	for i in range(1, n):
		if nums[i] - last > 1:
			return 'NO'
		last = nums[i]
	return 'YES'
t = int(input())
for _ in range(t):
	print(solve())


t = int(input())
l = []
for _ in range(t):
	n = int(input())
	a = sorted([int(x) for x in input().split()])
	l = []
	for i in range(len(a)):
		for j in range(i + 1, len(a)):
			d = a[j] - a[i]
			if d <= 1:
				l.append(a[i])
				break
	if len(a) - len(l) == 1:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	a = list(sorted(set(map(int, input().split()))))
	flag = True
	while flag:
		if len(a) == 1:
			print('YES')
			flag = False
		elif abs(a[1] - a[0]) <= 1:
			a.remove(min(a[0], a[1]))
		else:
			print('NO')
			flag = False


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


n = int(input())

def func(n):
	size = int(input())
	new = list(map(int, input().split()))
	new.sort()
	mini = 0
	for i in range(len(new) - 1):
		if abs(new[i] - new[i + 1]) <= 1:
			continue
		else:
			return 'NO'
	return 'YES'
for i in range(n):
	print(func(n))


a = int(input())
while a:
	x = int(input())
	ls = list(map(int, input().split()))[:x]
	ls.sort()
	f = 'YES'
	for i in range(len(ls) - 1):
		if abs(ls[i] - ls[i + 1]) > 1:
			f = 'NO'
			break
	print(f)
	a -= 1


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter
inp = lambda : int(input())
strng = lambda : input().strip()
jn = lambda x, l: x.join(map(str, l))
strl = lambda : list(input().strip())
mul = lambda : map(int, input().strip().split())
mulf = lambda : map(float, input().strip().split())
seq = lambda : list(map(int, input().strip().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
stdarr = lambda : map(int, stdstr().split())
mod = 1000000007
for _ in range(stdint()):
	n = stdint()
	arr = list(stdarr())
	arr = sorted(arr)
	if n == 1:
		print('YES')
		continue
	pos = True
	for i in range(n - 1):
		if arr[i + 1] - arr[i] > 1:
			pos = False
			break
	if pos:
		print('YES')
	else:
		print('NO')


import io, os
from collections import deque
import bisect
RL = lambda : list(map(int, input().split(' ')))
T = int(input())
for _ in range(T):
	a = int(input())
	l = RL()
	l.sort()
	flag = 1
	for i in range(1, a):
		if l[i - 1] == l[i] or l[i - 1] + 1 == l[i]:
			continue
		else:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


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


import sys, math
import io, os
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter

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

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write(' '.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
from decimal import Decimal
from fractions import Fraction
INF = float('inf')
mod = int(1000000000.0) + 7
for t in range(int(data())):
	n = int(data())
	a = sorted(mdata())
	k = 1
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			k = 0
			break
	if k:
		print('YES')
	else:
		print('NO')


test = int(input())
for _ in range(test):
	n = int(input())
	count = 0
	list1 = list(map(int, input().split()))
	if n == 1:
		print('YES')
	else:
		list1.sort()
		for k in range(n - 1):
			if abs(list1[k + 1] - list1[k]) > 1:
				count = 1
				break
		if count == 0:
			print('YES')
		else:
			print('NO')


import sys
input = sys.stdin.buffer.readline

def I():
	return list(map(int, input().split()))

def sieve(n):
	a = [1] * n
	for i in range(2, n):
		if a[i]:
			for j in range(i * i, n, i):
				a[j] = 0
	return a
for __ in range(int(input())):
	n = int(input())
	arr = sorted(I())
	diffs = []
	ans = 'YES'
	for i in range(n - 1):
		diffs.append(arr[i + 1] - arr[i])
		if arr[i + 1] - arr[i] > 1:
			ans = 'NO'
	print(ans)


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


t = int(input())
for i in range(t):
	n = int(input())
	data = list(map(int, input().split()))
	data = sorted(data)
	ndata = [1] * n
	for j in range(len(data) - 1):
		if data[j + 1] - data[j] <= 1:
			ndata[j] = 0
	if sum(ndata) > 1:
		print('NO')
	else:
		print('YES')


def solve(a):
	if len(a) == 1:
		return True
	a.sort()
	for i in range(len(a) - 1):
		if a[i + 1] - a[i] >= 2:
			return False
	return True
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	if solve(a):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	lst = [int(i) for i in input().split()]
	lst.sort()
	flag = 0
	for i in range(n):
		if i + 1 < n and abs(lst[i] - lst[i + 1]) > 1:
			print('NO')
			flag = 1
			break
	if not flag:
		print('YES')


def check(arr, n):
	i = 0
	while len(arr) != 1:
		if abs(arr[i] - arr[i + 1]) > 1:
			return 'NO'
		arr.remove(min(arr[i], arr[i + 1]))
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	print(check(arr, n))


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


def ans(A):
	A = sorted(A)
	for i in range(len(A) - 1):
		if abs(A[i] - A[i + 1]) > 1:
			return 'NO'
	return 'YES'
	return A
T = int(input())
for t in range(T):
	input()
	A = list(map(int, input().split()))
	print(ans(A))


t = int(input())
res = []
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l = sorted(l, reverse=True)
	w = True
	for (x, y) in zip(l[:-1], l[1:]):
		if x - y > 1:
			w = False
			break
	if w:
		res.append('YES')
	else:
		res.append('NO')
for i in range(t):
	print(res[i])


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	for i in range(len(l) - 1):
		if l[i + 1] - l[i] <= 1:
			l[i] = None
	if n - l.count(None) == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for test in range(t):
	poss = True
	n = int(input())
	ar = [int(x) for x in input().split()]
	if n == 1:
		print('YES')
	else:
		ar.sort()
		for x in range(n - 1):
			if abs(ar[x] - ar[x + 1]) > 1:
				poss = False
				break
		if poss:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	arr_len = int(input())
	arr = list(map(int, input().split()))
	f = 0
	arr.sort()
	if arr_len < 2:
		print('YES')
		continue
	for i in range(1, len(arr)):
		if arr[i] - arr[i - 1] > 1:
			f = 1
			break
	if f:
		print('NO')
	else:
		print('YES')


t = int(input())
for case in range(t):
	n = int(input())
	a = [int(s) for s in input().split(' ')]
	a.sort()
	jumps = [a[i + 1] - a[i] for i in range(n - 1) if a[i + 1] - a[i] > 1]
	if len(jumps) > 0:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	k = 0
	rf = 0
	while k < n:
		if k != 0:
			if abs(a[k] - a[k - 1] > 1):
				rf = 1
		k += 1
	if rf == 0:
		print('YES')
	else:
		print('NO')


tc = int(input())
for ip in range(tc):
	x = int(input())
	st = set(list(map(int, input().split())))
	s = list(st)
	if len(s) == 1:
		print('YES')
		continue
	p = 0
	s.sort()
	for n in range(1, len(s)):
		if s[n] - s[n - 1] != 1:
			p = 1
			break
	if p:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	numbers = int(input())
	list_ = list(map(int, input().split()))
	if numbers == 1:
		print('YES')
	else:
		list_.sort()
		a_list = list_[1:]
		b_list = list_[:-1]
		difference = []
		zip_object = zip(a_list, b_list)
		for (a_list_i, b_list_i) in zip_object:
			difference.append(a_list_i - b_list_i)
		if max(difference) > 1:
			print('NO')
		else:
			print('YES')


import sys
fast_reader = sys.stdin.readline
fast_writer = sys.stdout.write

def input():
	return fast_reader().strip()

def print(*argv):
	fast_writer(' '.join((str(i) for i in argv)))
	fast_writer('\n')
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ans = 'YES'
	for i in range(n - 1):
		if l[i + 1] - l[i] > 1:
			ans = 'NO'
			break
	print(ans)


for i in range(0, int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	b = sorted(b)
	k = 0
	c = 0
	d = 0
	while k < a - 1:
		if abs(b[k] - b[k + 1]) <= 1:
			c = c + 1
		else:
			d = d + 1
			break
		k += 1
	if d == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	nums = [int(x) for x in input().split()]
	if n == 1:
		print('YES')
	else:
		nums.sort()
		ans = 0
		for i in range(0, n - 1):
			if nums[i + 1] - nums[i] <= 1:
				ans += 1
		if ans == n - 1:
			print('YES')
		else:
			print('NO')


import sys
tc = int(sys.stdin.readline())
for _ in range(tc):
	n = int(sys.stdin.readline())
	arr = list(map(int, sys.stdin.readline().split()))
	check = sorted(arr)
	can = True
	for i in range(1, n):
		if check[i] - check[i - 1] > 1:
			can = False
			break
	if can:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().rstrip().split()))
	df = []
	if n == 1:
		print('YES')
		continue
	a.sort()
	chk = False
	for i in range(n - 1):
		if a[i + 1] - a[i] > 1:
			print('NO')
			chk = True
			break
	if chk == False:
		print('YES')


def check(numSet):
	if len(numSet) == 1:
		print('YES')
	elif numSet[1] - numSet[0] <= 1:
		numSet.remove(numSet[0])
		check(numSet)
	else:
		print('NO')
n = int(input())
for _ in range(n):
	input()
	numset = list(set(map(int, input().split())))
	numset.sort()
	check(list(numset))


t = int(input())
while t != 0:
	t = t - 1
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	res = 'YES'
	if len(a) != 1:
		for i in range(n - 1):
			if a[i + 1] - a[i] > 1:
				res = 'NO'
				break
	print(res)


t = int(input())
for _ in range(t):
	n = int(input())
	l1 = [int(x) for x in input().split()]
	l1.sort()
	i = 0
	while i < len(l1) - 1 and l1[1 + i] - l1[i] <= 1:
		i += 1
	if i == len(l1) - 1:
		print('YES')
	else:
		print('NO')


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


for i in range(int(input())):
	n = int(input())
	a = [int(y) for y in input().split()]
	m = len(set(a))
	if m == 1:
		print('YES')
	else:
		f = 0
		a = sorted(a)
		for i in range(n - 1):
			if abs(a[i] - a[i + 1]) > 1:
				f = 1
				break
		if f == 0:
			print('YES')
		else:
			print('NO')


def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
import collections as c

def solve():
	N = getInt()
	A = getInts()
	A.sort()
	for j in range(1, N):
		if A[j] - A[j - 1] > 1:
			return 'NO'
	return 'YES'
T = getInt()
for t in range(T):
	ans = solve()
	print(ans)


n = int(input())
for i in range(n):
	k = int(input())
	p = list(map(int, input().split()))
	p = sorted(p)
	s = 0
	for j in range(1, k):
		if p[j] - p[j - 1] > 1:
			s += 1
	if s > 0:
		print('NO')
	else:
		print('YES')


t = int(input())
while t > 0:
	flag = 0
	n = int(input())
	list1 = list(map(int, input().split()))[:n]
	list1.sort(reverse=True)
	for i in range(n - 1):
		if list1[i] - list1[i + 1] > 1:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')
	t -= 1


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


a = int(input())
while a > 0:
	x = int(input())
	y = list(map(int, input().rstrip().split()))
	y.sort()
	s = ''
	for i in range(len(y) - 1):
		if y[i + 1] - y[i] > 1:
			s = '#'
			break
	if s == '#':
		print('NO')
	else:
		print('YES')
	a -= 1


def get_answer(a):
	a = sorted(a)
	for (curr_x, next_x) in zip(a, a[1:]):
		if next_x > curr_x + 1:
			return False
	return True

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		a = tuple(map(int, input().split()))
		can_remain_one_element = get_answer(a)
		output = 'YES' if can_remain_one_element else 'NO'
		print(output)
main()


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def foo():
	n = inp()
	lst = inlt()
	lst.sort()
	for i in range(1, n):
		if abs(lst[i] - lst[i - 1]) > 1:
			print('NO')
			return
	print('YES')
t = inp()
for i in range(t):
	foo()


t = int(input())
for j in range(t):
	n = int(input())
	L = map(int, input().split())
	L = list(L)
	K = []
	for i in L:
		K = K + [i]
	K = sorted(K)
	k = 0
	for i in range(n - 1):
		if K[i] < K[i + 1] - 1:
			k = 1
			break
	if k == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	END = False
	while not END:
		END = True
		i = 1
		while i < len(a):
			if abs(a[i] - a[i - 1]) <= 1:
				if a[i] > a[i - 1]:
					a.pop(i - 1)
				else:
					a.pop(i)
				END = False
			else:
				i += 1
	if len(a) == 1:
		print('YES')
	else:
		print('NO')


for case in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a = sorted(a)
	ans = 'NO'
	i = 0
	while i != len(a) - 1:
		if a[i] == a[i + 1] or a[i] + 1 == a[i + 1]:
			a = a[1:]
		else:
			i += 1
	if len(a) == 1:
		ans = 'YES'
	print(ans)


try:
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		if n == 1:
			print('YES')
			continue
		flag = True
		x = sorted(a)
		for i in range(1, n):
			if x[i] - x[i - 1] > 1:
				flag = False
				break
		if flag == True:
			print('YES')
		else:
			print('NO')
except:
	pass


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


import math
from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	if len(a) == 1:
		print('YES')
	else:
		a.sort()
		tmp = n
		for x in range(1, n):
			if a[x] - a[x - 1] <= 1:
				tmp -= 1
		if tmp == 1:
			print('YES')
		else:
			print('NO')


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


results = []
tests = int(input())
for _x in range(tests):
	n = int(input())
	a = list((int(item) for item in input().split()))[:n]
	a.sort()
	ok = True
	for i in range(1, len(a)):
		if a[i] - a[i - 1] > 1:
			ok = False
			break
	if ok:
		results.append('YES')
	else:
		results.append('NO')
print(*results, sep='\n')


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


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


for _ in range(int(input())):
	x = int(input())
	amr = list(map(int, input().split()))
	amr.sort()
	flag = True
	for i in range(1, x):
		if amr[i] - amr[i - 1] <= 1:
			continue
		else:
			flag = False
			break
	print('YES' if flag == True else 'NO')


t = int(input())
for q in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	c = 0
	for i in range(0, n - 1):
		j = i + 1
		if abs(a[i] - a[j]) <= 1:
			a[a.index(min(a[i], a[j]))] = 105
	if n - a.count(105) == 1:
		print('YES')
	else:
		print('NO')


def solve():
	for _ in range(ii()):
		n = ii()
		a = sorted(li())
		if n == 1:
			print('YES')
			continue
		ha = False
		ini = a[0]
		for ai in a[1:]:
			if ai - ini > 1:
				ha = True
				break
			else:
				ini = ai
		print('NO' if ha else 'YES')
ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
si = lambda : input()
solve()


for i in range(0, int(input())):
	c = 0
	n = int(input())
	a = []
	a = [int(x) for x in input().split()]
	a.sort()
	i = 1
	while i < n:
		if a[i] - a[i - 1] > 1:
			c = 1
		i += 1
	if c == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	a = sorted([int(_) for _ in input().split()])
	for (x, y) in zip(a, a[1:]):
		if abs(x - y) > 1:
			print('NO')
			break
	else:
		print('YES')


n = int(input())
count = 0
for i in range(0, n):
	m = int(input())
	num = list(map(int, input().split()))
	num.sort()
	for j in range(0, m - 1):
		if num[j + 1] - num[j] == 0 or num[j + 1] - num[j] == 1:
			count += 1
	if count == m - 1:
		print('YES')
	else:
		print('NO')
	count = 0


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


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


def solve():
	n = int(input())
	a = sorted(list(map(int, input().split())))
	res = True
	for i in range(1, n):
		if abs(a[i] - a[i - 1]) > 1:
			res = False
			break
	print('YES' if res else 'NO')
for _ in range(int(input().strip())):
	solve()


import sys
input = sys.stdin.readline
LI = lambda : list(map(int, input().split()))
MI = lambda : map(int, input().split())
SI = lambda : input().strip('\n')
II = lambda : int(input())
for _ in range(II()):
	n = II()
	a = sorted(MI())
	ok = True
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			ok = False
	print('YES' if ok else 'NO')


from collections import defaultdict, deque

def main():
	t = int(input())
	for c in range(t):
		n = int(input())
		ar = list(sorted(map(int, input().split(' '))))
		print('YES' if len([i for i in range(n) if i + 1 < n and ar[i + 1] - ar[i] > 1]) == 0 else 'NO')
main()


from sys import stdin

def r():
	return stdin.readline().strip()

def r_t(tp):
	return map(tp, r().strip().split())

def r_l(tp):
	return list(r_t(tp))

def solve(n, A):
	A.sort()
	for i in range(n - 1):
		if abs(A[i] - A[i + 1]) > 1:
			return 'NO'
	return 'YES'

def main():
	cases = int(r())
	for _ in range(cases):
		n = int(r())
		A = r_l(int)
		print(solve(n, A))
main()


import sys
from sys import stdin
import math

def iinput():
	return int(input())

def minput():
	return map(int, input().split())

def linput():
	return list(map(int, input().split()))

def fiinput():
	return int(stdin.readline())

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

def flinput():
	return list(map(int, stdin.readline().strip().split()))
for _ in range(iinput()):
	n = iinput()
	list1 = linput()
	c1 = 0
	c2 = 0
	c3 = 0
	list1.sort()
	for i in range(n - 1):
		if abs(list1[i] - list1[i + 1]) == 1:
			c2 += 1
		elif abs(list1[i] - list1[i + 1]) == 0:
			c1 += 1
		else:
			c3 += 1
	if c3 > 0:
		print('NO')
	else:
		print('YES')


def remove_smallest():
	matchCount = int(input())
	outerCount = 1
	outputList = []
	while outerCount <= matchCount:
		numberList = []
		listCount = int(input())
		innerCount = 1
		numberList = [int(num) for num in input().split()]
		check_remove_smallest_possible(numberList, outputList)
		outerCount = outerCount + 1
	for result in outputList:
		print(result)

def check_remove_smallest_possible(numberList, outputList):
	if len(numberList) == 1:
		outputList.append('YES')
	else:
		numberListModofied = list(set(numberList))
		numberListModofied.sort()
		if len(numberListModofied) == 1:
			outputList.append('YES')
		i = 0
		j = 1
		while j < len(numberListModofied) and len(numberListModofied) > 1:
			if abs(numberListModofied[i] - numberListModofied[j]) != 1:
				outputList.append('NO')
				break
			else:
				i = i + 1
				j = j + 1
				if j == len(numberListModofied):
					outputList.append('YES')
remove_smallest()


import sys
from functools import lru_cache
from collections import defaultdict

def solve(arr):
	if len(arr) == 1:
		return True
	arr.sort()
	for (a, b) in zip(arr, arr[1:]):
		if a == b:
			continue
		elif a == b - 1:
			continue
		return False
	return True

def main(mat):
	for a in mat:
		if solve(a):
			print('YES')
		else:
			print('NO')
mat = []
for (e, line) in enumerate(sys.stdin.readlines()):
	if e == 0:
		continue
	elif e % 2 == 0:
		mat.append(list(map(int, line.strip().split())))
main(mat)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	p = 0
	q = 0
	for j in range(n - 1):
		if a[j] - a[j + 1] > 1:
			p = p + 1
		else:
			q = q + 1
	if p > 0:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	a = sorted(map(int, input().split()))
	for (a1, a2) in zip(a[:-1], a[1:]):
		if a2 - a1 > 1:
			print('NO')
			break
	else:
		print('YES')


def read():
	return [int(x) for x in input().split()]
(cas,) = read()
for _ in range(cas):
	(n,) = read()
	x = sorted(read())
	f = True
	for i in range(1, n):
		if x[i] > x[i - 1] + 1:
			f = False
	print('YES' if f else 'NO')


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


for i in range(int(input())):
	l = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	fl = 0
	if len(arr) == 2:
		if arr[1] - arr[0] > 1:
			print('NO')
		else:
			print('YES')
	elif len(arr) == 1:
		print('YES')
	else:
		for i in range(1, len(arr)):
			if arr[i] - arr[i - 1] > 1:
				print('NO')
				fl = 1
				break
		if fl == 0:
			print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	li = list(map(int, input().split()))
	li.sort()
	ok = 'YES'
	for j in range(1, n):
		if li[j] - li[j - 1] > 1:
			ok = 'NO'
	print(ok)


t = int(input())
for x in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	p = 0
	c = 0
	while len(a) > 1:
		if a[1] - a[0] <= 1:
			a.pop(0)
		else:
			break
	if len(a) > 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	n = int(input())
	a1 = input().split()
	a = []
	for i in a1:
		a.append(int(i))
	a.sort()
	for i in range(n - 1):
		if a[i + 1] - a[i] <= 1:
			continue
		else:
			print('NO')
			break
	else:
		print('YES')


a = int(input())
for x in range(a):
	b = int(input())
	c = list(map(int, input().split()))
	c.sort()
	p = 0
	for x in range(b - 1):
		if abs(c[x] - c[x + 1]) < 2:
			p += 1
		else:
			break
	if p == b - 1:
		print('YES')
	else:
		print('NO')


tc = int(input())
for ctr in range(tc):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) > 1:
			print('NO')
			break
	else:
		print('YES')


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

def inara():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	n = inp()
	ara = inara()
	ara.sort()
	flag = True
	for i in range(1, n):
		flag &= ara[i] - ara[i - 1] <= 1
	if flag:
		print('YES')
	else:
		print('NO')


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin, ceil, log2
from bisect import bisect_right, bisect_left
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def factorial(n):
	if n == 0:
		return 1
	return n * factorial(n - 1)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def Golomb(n):
	dp = [0] * (n + 1)
	dp[1] = 1
	for i in range(2, n + 1):
		dp[i] = 1 + dp[i - dp[dp[i - 1]]]
	return dp[1:]

def solve(leftAllowed, leftLast, ix, movesLeft, dp, a):
	if dp[leftAllowed][leftLast][ix] != -1:
		return dp[leftAllowed][leftLast][ix]
	if movesLeft == 0:
		return 0
	res = 0
	if leftLast == 0 and ix > 0 and (leftAllowed > 0):
		res = max(res, solve(leftAllowed - 1, 1, ix - 1, movesLeft - 1, dp, a) + a[ix - 1])
	res = max(res, solve(leftAllowed, 0, ix + 1, movesLeft - 1, dp, a) + a[ix + 1])
	dp[leftAllowed][leftLast][ix] = res
	return dp[leftAllowed][leftLast][ix]
MOD = 1000000007
PMOD = 998244353
T = 1
T = int(stdin.readline())
for _ in range(T):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().rstrip().split()))
	if n == 1:
		print('YES')
		continue
	a.sort()
	flag = True
	for i in range(1, n):
		if abs(a[i] - a[i - 1]) > 1:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	vec = list(map(int, input().split()))
	vec.sort()
	ok = True
	for i in range(1, n):
		ok &= vec[i] - vec[i - 1] <= 1
	print('YES' if ok else 'NO')


for _ in range(int(input().strip(' '))):
	l = int(input().strip(' '))
	a = list(map(int, input().strip(' ').split(' ')))
	(i, j) = (0, 0)
	a.sort()
	posssible = True
	while i < len(a) and j < len(a) - 1:
		if a[j + 1] - a[i] <= 1:
			posssible = True
		else:
			posssible = False
			break
		i += 1
		j += 1
	if posssible:
		print('YES')
	else:
		print('NO')


CORRECT = 'YES'
INCORRECT = 'NO'

def solve(string):
	numbers = [int(i) for i in string.split()]
	if len(numbers) == 1:
		return CORRECT
	numbers.sort()
	last_number = numbers[0]
	for current_number in numbers[1:]:
		if abs(current_number - last_number) > 1:
			return INCORRECT
		last_number = current_number
	return CORRECT
t = int(input())
result = list()
for _ in range(t):
	n = input()
	result.append(solve(input()))
print('\n'.join(result))


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	arr = list(map(int, input().strip().split()))
	arr = sorted(arr)
	ele = arr[0]
	flag = 0
	for i in range(1, n):
		if arr[i] - ele > 1:
			print('NO')
			flag = 1
			break
		ele = arr[i]
	if flag == 0:
		print('YES')


T = int(input())
for t in range(T):
	N = int(input())
	x = list(map(int, input().split()))
	x.sort()
	count = 0
	ans = [abs(x[n] - x[n - 1]) for n in range(1, len(x))]
	for k in range(len(ans)):
		if ans[k] > 1:
			count += 1
	if count >= 1:
		print('NO')
	else:
		print('YES')


def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
n = inp()
for _ in range(n):
	m = inp()
	l = inlt()
	l.sort()
	t = 1
	prev = l[0]
	cnt = 0
	while t < m:
		if prev != -1 and l[t] > prev + 1:
			cnt += 1
		prev = l[t]
		t += 1
	if cnt > 0:
		print('NO')
	else:
		print('YES')


t = int(input())
import collections as c
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	tr = 1
	b = []
	for i in range(1, n):
		b.append(abs(a[i] - a[i - 1]))
	for i in b:
		if i > 1:
			tr = 0
			break
	if tr == 0:
		print('NO')
	else:
		print('YES')


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


def answer(A):
	A.sort()
	if len(A) == 1:
		return True
	if len(A) == 2:
		return A[1] - A[0] <= 1
	else:
		diff_a = []
		for i in range(0, len(A) - 1):
			if A[i + 1] - A[i] <= 1:
				del A[i]
				return answer(A)
			else:
				continue
	return False
T = int(input())
for i in range(0, T):
	N = input()
	l = list(map(int, input().strip().split()))
	print('YES' if answer(l) else 'NO')


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


t = int(input())
for _ in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	b = a.copy()
	for i in range(n - 1):
		if abs(a[i + 1] - a[i]) > 1:
			print('NO')
			break
	else:
		print('YES')


import sys, os.path
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
t = int(input())
while t:
	t -= 1
	input()
	ls = list(map(int, input().split()))
	ls.sort()
	for i in range(1, len(ls)):
		if ls[1] - ls[0] <= 1:
			ls.pop(0)
		else:
			print('NO')
			break
	if len(ls) == 1:
		print('YES')


import math
t = int(input())
for case in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	if n == 1:
		print('YES')
	else:
		for i in range(1, n):
			if a[i] - a[i - 1] > 1:
				print('NO')
				break
		else:
			print('YES')


T = int(input())
for I in range(0, T):
	X = input()
	Y = sorted(list(map(int, input().split(' '))))
	Z = 'YES'
	for J in range(1, len(Y)):
		if Y[J] - Y[J - 1] > 1:
			Z = 'NO'
			break
	print(Z)


def main():
	n = int(input())
	mass = list(map(int, input().split(' ')))
	mass.sort()
	i = 1
	flag = True
	while i < len(mass):
		if abs(mass[i - 1] - mass[i]) > 1:
			print('NO')
			flag = False
			i = len(mass)
		i += 1
	if flag:
		print('YES')
cont = int(input())
for i in range(cont):
	main()


for t in range(int(input())):
	n = int(input())
	arr = sorted(list(map(int, input().split())))
	flg = True
	for i in range(1, n):
		if abs(arr[i] - arr[i - 1]) > 1:
			flg = False
			break
	if flg:
		print('YES')
	else:
		print('NO')


def small(a, b):
	c = len(a)
	d = a[0]
	for i in range(0, b):
		if abs(a[i] - d) >> 1:
			return 'NO'
		d = a[i]
	return 'YES'
for i in range(int(input())):
	b = int(input())
	e = list(map(int, input().split()))
	e.sort()
	print(small(e, b))


def remove_smallest(n, a):
	if n == 1:
		return 'YES'
	else:
		a.sort()
		for i in range(n - 1):
			if a[i + 1] - a[i] > 1:
				return 'NO'
		return 'YES'
test_cases = int(input())
for _ in range(test_cases):
	n = input()
	a = [int(i) for i in input().split()]
	print(remove_smallest(len(a), a))


from sys import stdin, stdout
from math import gcd
input = stdin.readline
print = stdout.write

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


t = int(input())
for i in range(t):
	n = int(input())
	d = input().split(' ')
	for j in range(n):
		d[j] = int(d[j])
	d = sorted(d)
	if n == 1:
		print('YES')
		continue
	vis = 0
	for j in range(n - 1):
		if d[j + 1] - d[j] > 1:
			vis = 1
	if vis == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
import math
while t > 0:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	i = 0
	j = 0
	l.sort()
	while i < len(l) - 1:
		if abs(l[i] - l[i + 1]) <= 1:
			l.pop(i)
		else:
			i += 1
	if j == 0 and len(l) == 1:
		print('YES')
	else:
		print('NO')


def func(a, b):
	if len(b) == 1:
		return 25
	else:
		ind = b[0]
		del b[0]
		if ind + 1 in b or ind in b:
			return func(a - 1, b)
		else:
			return 26
t = int(input())
for g in range(t):
	len_1 = int(input())
	list_1 = list(map(int, input().split()))
	list_1.sort()
	h = func(len_1, list_1)
	if h == 25:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	if len(arr) == 1 or len(set(arr)) == 1:
		print('YES')
	else:
		max = 0
		for i in range(len(arr) - 1):
			current_max = arr[i + 1] - arr[i]
			if current_max > max:
				max = current_max
		if max > 1:
			print('NO')
		else:
			print('YES')


for _ in range(int(input())):
	n = int(input())
	v = list(map(int, input().split()))
	v.sort()
	a = [0]
	for i in range(1, len(v)):
		a.append(v[i] - v[i - 1])
	flag = 0
	for i in a:
		if i > 1 or i < -1:
			print('NO')
			flag = 1
			break
	if flag == 0:
		print('YES')


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


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


for x in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	ans = 'YES'
	for i in range(1, n):
		if a[i] - a[i - 1] <= 1:
			continue
		else:
			ans = 'NO'
	print(ans)


def test(inputArray):
	if len(inputArray) <= 1:
		return True
	L = [i for i in set(inputArray)]
	L.sort()
	for i in range(len(L) - 1):
		if L[i + 1] - L[i] >= 2:
			return False
	return True
numberOfInputs = int(input())
for rounds in range(numberOfInputs):
	l = input()
	array = [int(i) for i in input().split(' ')]
	if test(array):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	a = int(input())
	arr = [int(x) for x in input().split()]
	temp = arr.sort()
	possible = True
	for j in range(a - 1):
		if abs(arr[j] - arr[j + 1]) > 1:
			possible = False
			break
	if possible == True:
		print('YES')
	else:
		print('NO')


nb_tests = int(input())
for _ in range(nb_tests):
	n = int(input())
	a = input().split()
	branches = [[int(a[0])]]
	for i in range(1, n):
		cur = int(a[i])
		found = False
		for (j, branch) in enumerate(branches):
			if branch[0] - 1 <= cur <= branch[-1] + 1:
				found = True
				if cur == branch[0] - 1:
					merged = False
					if j > 0:
						if cur == branches[j - 1][-1] + 1:
							merged_branch = [branches[j - 1][0], branch[1]]
							branches[j - 1] = merged_branch
							del branches[j]
							merged = True
					if not merged:
						branches[j] = [cur, branch[-1]]
					break
				elif cur == branch[-1] + 1:
					merged = False
					if j < len(branches) - 1:
						if cur == branches[j + 1][0] - 1:
							merged_branch = [branch[0], branches[j + 1][-1]]
							branches[j] = merged_branch
							del branches[j + 1]
							merged = True
					if not merged:
						branches[j] = [branch[0], cur]
					break
		if not found:
			branches.append([cur])
			branches.sort()
	result = 'YES' if len(branches) == 1 else 'NO'
	print(result)


def sol(b, n):
	b.sort()
	for i in range(1, n):
		if b[i] - b[i - 1] > 1:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(sol(a, n))


def getAns(n, a):
	a.sort()
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			return 'NO'
	return 'YES'

def main():
	t = int(input())
	anss = [''] * t
	for i in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		anss[i] = getAns(n, a)
	for ans in anss:
		print(ans)
main()


def rem_smallest(arr):
	arr.sort()
	for i in range(1, len(arr)):
		if arr[i] - arr[i - 1] == 1 or arr[i] == arr[i - 1]:
			pass
		else:
			return 'NO'
	else:
		return 'YES'
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(rem_smallest(arr))


a = int(input())
for i in range(a):
	k = int(input())
	l = list(set(map(int, input().split())))
	while len(l) != 1:
		j = min(l)
		l.remove(j)
		b = min(l)
		if b - j > 1:
			print('NO')
			break
	else:
		print('YES')


def sol(s):
	for i in range(len(s) - 1):
		if abs(s[i] - s[i + 1]) > 1:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = sorted(set(a))
	print(sol(s))


for _ in range(int(input())):
	n = int(input())
	c = 0
	arr = list(map(int, input().split()))
	arr.sort()
	for x in range(0, n - 1):
		if arr[x + 1] - arr[x] > 1:
			c += 1
			break
	if c > 0:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	flag = True
	while len(l) > 1:
		p = l[0]
		p1 = l[1]
		c = abs(p - p1)
		if c > 1:
			print('NO')
			flag = False
			break
		else:
			l.pop(0)
	if flag:
		print('YES')


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


x = int(input())
for _ in range(x):
	_ = input()
	arr = input().split()
	arr = [int(char) for char in arr]
	arr.sort()
	len_arr = len(arr)
	for i in range(1, len(arr)):
		if abs(arr[i] - arr[i - 1]) <= 1:
			len_arr -= 1
	if len_arr <= 1:
		print('YES')
	else:
		print('NO')


import sys
read = lambda : sys.stdin.readline().strip()
for _ in range(int(read())):
	length = int(read())
	nums = list(map(int, read().split()))
	nums.sort()
	for i in range(1, length):
		if abs(nums[i] - nums[i - 1]) > 1:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for ex in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	if n == 1:
		print('YES')
	else:
		max_diff = a[1] - a[0]
		for i in range(2, n):
			max_diff = max(max_diff, a[i] - a[i - 1])
		if max_diff <= 1:
			print('YES')
		else:
			print('NO')


import random

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

def lcm(a, b):
	return a * b / gcd(a, b)
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	f = 0
	i = 1
	while i < n:
		if a[i] - a[i - 1] <= 1:
			i += 1
		else:
			i += 1
			f += 1
	if f <= 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	n = int(input())
	a = map(int, input().split())
	a = list(set(a))
	d = 0
	a.sort()
	for i in range(len(a) - 1):
		if abs(a[i + 1] - a[i]) > 1:
			d = 1
	if d == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for case in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a = list(sorted(a))
	b = [a[0]]
	for i in range(1, n):
		if a[i] != a[i - 1]:
			b.append(a[i])
	n2 = len(b)
	if b[-1] - b[0] + 1 == n2:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.buffer.readline

def ch():
	n = int(input())
	a = sorted(list(map(int, input().split())))
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) > 1:
			return False
	return True
t = int(input())
while t:
	t -= 1
	if ch() == True:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	l = input().split(' ')
	s = ''
	count = 0
	if len(l) == 1:
		s = 'YES'
	else:
		for i in range(len(l)):
			l[i] = int(l[i])
		l.sort()
		for i in range(len(l) - 1):
			if l[i] == l[i + 1] - 1 or l[i] == l[i + 1]:
				count += 1
	if count == len(l) - 1:
		s = 'YES'
	else:
		s = 'NO'
	print(s)


for _ in range(int(input())):
	c = 0
	n = int(input())
	arr = sorted(set(map(int, input().split())))
	if arr[len(arr) - 1] - arr[0] == len(arr) - 1:
		c = 1
	if c != 0:
		print('YES')
	else:
		print('NO')


tc = int(input())
for i in range(tc):
	size = int(input())
	a = list(map(int, input().split()))
	a.sort()
	size = len(a)
	output = 'YES'
	for j in range(size - 1):
		diff = a[j + 1] - a[j]
		if diff > 1:
			output = 'NO'
			break
	print(output)


t = int(input())
for case in range(t):
	len_arr = int(input())
	arr = map(int, input().split(' '))
	arr = sorted(arr)
	res = True
	for i in range(len(arr) - 1):
		if arr[i + 1] - arr[i] > 1:
			res = False
			break
	print('YES' if res else 'NO')


for _ in range(int(input())):
	k = int(input())
	l = list(map(int, input().split()))
	l.sort()
	i = 0
	z = 0
	while i < len(l) - 1:
		if abs(l[i + 1] - l[i]) >= 2:
			z = 1
			break
		i = i + 1
	if z != 1:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
q = int(input())
for i in range(q):
	n = int(input())
	a = list(map(int, stdin.readline().split()))
	a.sort()
	flag = 0
	for i in range(1, n):
		if a[i] - a[i - 1] > 1:
			flag = 1
			break
	if flag == 0:
		print('YES')
	else:
		print('NO')


testcases = int(input())
for i in range(testcases):
	n = int(input())
	arr = list(map(int, input().split()))
	done = False
	arr.sort()
	for j in range(n - 1):
		if arr[j + 1] - arr[j] > 1:
			done = True
			print('NO')
			break
	if not done:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	a = sorted([int(i) for i in input().split()])
	ans = 'YES'
	for i in range(n - 1):
		if abs(a[i] - a[i + 1]) > 1:
			ans = 'NO'
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	t = 0
	for j in range(1, len(a)):
		if a[j] - a[j - 1] > 1:
			t = 1
			break
	print('YNEOS'[t::2])


t = int(input())
s = ''
while t > 0:
	n = int(input())
	flag = True
	list = [int(i) for i in input().split()]
	list.sort(reverse=True)
	for i in range(n - 1):
		if abs(list[i] - list[i + 1]) > 1:
			s += 'NO\n'
			flag = False
			break
	if flag:
		s += 'YES\n'
	t -= 1
print(s)


from sys import stdin
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = sorted(set(map(int, stdin.readline().split())))
	if len(a) == 1:
		print('YES')
		continue
	t = [a[i + 1] - a[i] for i in range(len(a) - 1) if a[i + 1] - a[i] <= 1]
	if len(t) == len(a) - 1:
		print('YES')
	else:
		print('NO')


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


for t in range(int(input())):
	n = int(input())
	ar = [int(x) for x in input().split()]
	ar.sort()
	count = 0
	if n != 1:
		for x in range(n - 1):
			if abs(ar[x] - ar[x + 1]) > 1:
				count += 1
		if count > 0:
			print('NO')
		else:
			print('YES')
	else:
		print('YES')


for i in range(int(input())):
	user = input()
	ls = sorted(list(map(int, input().split())))
	a = ls[0]
	for j in ls[1:]:
		if j == a or j == a + 1:
			a = j
		else:
			print('NO')
			break
	else:
		print('YES')


import sys
input = sys.stdin.buffer.readline

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


for _ in range(int(input())):
	l = int(input())
	l1 = list(map(int, input().split()))
	l1.sort()
	c = 1
	for i in range(1, len(l1)):
		if l1[i] - l1[i - 1] > 1:
			c += 1
			break
	if c == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	l = [int(i) for i in input().split()]
	ans = ''
	l.sort()
	if len(l) == 1:
		print('YES')
	else:
		try:
			for i in range(1, len(l) + 1):
				if l[i] - l[i - 1] <= 1:
					ans = 'YES'
				else:
					ans = 'NO'
					break
		except:
			pass
		print(ans)
	t = t - 1


t = int(input())
for i in range(t):
	a = int(input())
	A = list(map(int, input().split()))
	A.sort()
	k = 0
	ans = 0
	while k != a - 1:
		if abs(A[k] - A[k + 1]) > 1:
			ans = 1
			break
		k += 1
	if ans == 1:
		ans = 'NO'
	else:
		ans = 'YES'
	print(ans)


T = int(input())
for case in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	min_item = min(a)
	max_item = max(a)
	for i in range(min_item + 1, max_item):
		if i not in a:
			print('NO')
			break
	else:
		print('YES')


t = int(input())
for x in range(0, t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	b = arr[0]
	ans = 'YES'
	for i in range(1, n):
		if arr[i] - b > 1:
			ans = 'NO'
			break
		b = arr[i]
	print(ans)


def f(l):
	for i in range(len(l) - 1):
		if l[i + 1] - l[i] > 1:
			return 'NO'
	return 'YES'
for i in range(int(input())):
	n = int(input())
	l = set(map(int, input().split()))
	l = list(l)
	l.sort()
	print(f(l))


test_cases = int(input())
for test_case in range(test_cases):
	n = int(input())
	a = list(map(int, input().split()))
	count = 0
	a.sort()
	for i in range(n - 1):
		if len(a) == 1:
			print('YES')
			break
		if a[i + 1] - a[i] > 1:
			print('NO')
			break
		else:
			count += 1
	if count == n - 1:
		print('YES')


def run():
	n = int(input())
	nums = list(map(int, input().split()))
	nums.sort()
	found = False
	for i in range(1, len(nums)):
		if nums[i] - nums[i - 1] > 1:
			print('NO')
			found = True
			break
	if not found:
		print('YES')
t = int(input())
for i in range(t):
	run()


def ans(n, A):
	A.sort()
	for i in range(n - 1):
		if A[i + 1] - A[i] <= 1:
			continue
		else:
			return 'NO'
	return 'YES'
L = []
t = int(input())
for i in range(t):
	n = int(input())
	A = [int(x) for x in input().split()]
	L.append(ans(n, A))
for l in L:
	print(l)


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


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


t = int(input())
for _ in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	l.sort()
	check = True
	for i in range(n - 1):
		if abs(l[i + 1] - l[i]) > 1:
			check = False
			break
	if check:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	diff = []
	for i in range(n - 1):
		diff.append(l[i + 1] - l[i])
	if set(diff) == {1} or set(diff) == {0} or set(diff) == {0, 1} or (n == 1):
		print('YES')
	else:
		print('NO')


def sample(a, n):
	(p1, p2) = (0, 1)
	while p1 < p2 and p2 < len(a):
		if abs(a[p1] - a[p2]) <= 1:
			if a[p1] <= a[p2]:
				a.pop(p1)
			else:
				a.pop(p2)
		else:
			p2 += 1
	if len(a) == 1:
		return 'YES'
	else:
		return 'NO'
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	if len(a) == 1:
		print('YES')
	else:
		print(sample(a, n))


z = int(input())
for i in range(z):
	a = int(input())
	l = list(map(int, input().split()))
	l.sort()
	xq = 0
	cd = 0
	if len(l) == 1:
		print('YES')
	else:
		for i in range(len(l) - 1):
			if abs(l[i] - l[i + 1]) > 1:
				print('NO')
				cd += 1
				break
			else:
				xq += 1
	if xq > 0 and cd == 0:
		print('YES')


from sys import stdin, stdout
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	while len(a) > 1:
		if a[-1] - a[-2] <= 1:
			a.pop()
		else:
			break
	if len(a) == 1:
		stdout.write('YES' + '\n')
	else:
		stdout.write('NO' + '\n')


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	f = True
	for i in range(n - 1):
		if l[i + 1] - l[i] > 1:
			f = False
			break
	if f:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	ls = list(map(int, input().split()))
	ls.sort()
	if n == 1:
		print('YES')
		continue
	for j in range(1, n):
		if abs(ls[j] - ls[j - 1]) > 1:
			print('NO')
			break
	else:
		print('YES')


from sys import stdin, stdout

def main():
	t = int(stdin.readline())
	for _ in range(t):
		n = int(stdin.readline())
		ary = list(map(int, stdin.readline().split()))
		ary.sort()
		ans = 'YES'
		for i in range(1, n):
			if ary[i] - ary[i - 1] > 1:
				ans = 'NO'
				break
		stdout.write(ans)
		stdout.write('\n')
	return
main()


def removeSmall(List):
	List = sorted(List)
	for i in range(len(List) - 1):
		if not List[i + 1] - List[i] <= 1:
			return 'NO'
	return 'YES'

def takeInput(List):
	lis = list(map(int, input().split()))
	List.append(lis)

def __main__():
	AllInput = []
	t = int(input())
	for counter in range(t):
		n = int(input())
		takeInput(AllInput)
	for counter in range(t):
		print(removeSmall(AllInput[counter]))
	return
__main__()


total = int(input())
for test_cases in range(total):
	length = int(input())
	num_list = list(map(int, input().split()))
	num_list.sort()
	if len(num_list) == 1:
		print('YES')
	else:
		for i in range(1, len(num_list)):
			if num_list[i] - num_list[i - 1] > 1:
				print('NO')
				break
		else:
			print('YES')


import math
import datetime
import collections
import statistics
import itertools

def is_prime(num):
	for i in range(2, int(math.sqrt(num)) + 1):
		if num % i == 0:
			return False
	return True

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


n = int(input())
elements = list()
ans = True
for i in range(n):
	nint = input()
	elements = [int(i) for i in input().split()]
	elements.sort()
	for i in range(len(elements) - 1):
		if abs(elements[i + 1] - elements[i]) > 1:
			ans = False
	print('YES') if ans else print('NO')
	ans = True


T = int(input())
for i in range(T):
	temp1 = int(input())
	temp = input()
	temp = temp.split()
	for i in range(temp1):
		temp[i] = int(temp[i])
	temp.sort()
	t = 0
	if temp1 != 1:
		for i in range(temp1):
			if abs(temp[i] - temp[i + 1]) <= 1:
				if temp1 == i + 2:
					t = temp1 - 1
					break
			else:
				break
	if t == temp1 - 1:
		print('YES')
	else:
		print('NO')


def check(arr, n):
	arr = sorted(arr)
	for i in range(n):
		if arr[i] - arr[i - 1] >= 2:
			return 'NO'
	return 'YES'
number_test = int(input())
for i in range(number_test):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = check(arr, n)
	print(ans)


t = int(input())
list1 = []
ans = 'YES'
for i in range(t):
	lenght = int(input())
	listnum = input().split(' ')
	for x in listnum:
		x = int(x)
		list1.append(x)
	list1 = sorted(list1)
	if len(list1) == 1:
		print('YES')
	else:
		for y in range(lenght - 1):
			first = list1[y]
			second = list1[y + 1]
			if abs(first - second) > 1:
				ans = 'NO'
				break
			else:
				ans = 'YES'
		print(ans)
	list1 = []