Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. 

Watson gives an array A of N integers A_{1}, A_{2}, ..., A_{N} to Sherlock. He wants Sherlock to reorganize the array in a way such that no two adjacent numbers differ by more than 1.
Formally, if reorganized array is B_{1}, B_{2}, ..., B_{N}, then the condition that | B_{i} - B_{i + 1} | ≤ 1, for all 1 ≤ i < N(where |x| denotes the absolute value of x) should be met.
Sherlock is not sure that a solution exists, so he asks you.

------ Input ------ 

First line contains T, number of test cases. Each test case consists of N in one line followed by N integers in next line denoting A_{1}, A_{2}, ..., A_{N}.

------ Output ------ 

For each test case, output in one line YES or NO denoting if array A can be reorganized in required way or not.

------ Constraints ------ 

$1 ≤ T ≤ 100$
$1 ≤ N ≤ 10^{5}$
$1 ≤ A_{i} ≤  10^{9}$
$Sum of N over all test cases  ≤ 2*10^{5}$

----- Sample Input 1 ------ 
2
4
3 2 2 3 
2
1 5
----- Sample Output 1 ------ 
YES
NO
----- explanation 1 ------ 

Test case 1:
No need to reorganise.

Test case 2:
No possible way.

Source: codechef | Difficulty: EASY


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


for _ in range(0, int(input())):
	a = int(input())
	b = [int(x) for x in input().split()]
	c = b
	c.sort()
	t = True
	for i in range(0, len(c) - 1):
		if c[i + 1] - c[i] > 1:
			t = False
			break
	d = 'YES' if t else 'NO'
	print(d)


from typing import List

def myDiffOk(Rec: List[int], N: int) -> str:
	result = 'YES'
	for i in range(1, len(Rec)):
		if Rec[i] - Rec[i - 1] > 1:
			result = 'NO'
			break
	return result
T = int(input())
record = []
while T > 0:
	N = int(input())
	record = list(map(int, input().split()))
	print(myDiffOk(record, N))
	record.clear()
	T -= 1


T = int(input())
for t in range(T):
	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')


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


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


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


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 + 1] - arr[i] > 1:
			print('NO')
			break
	else:
		print('YES')


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


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


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


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


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


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


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


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


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


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


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ln = 0
	bol = True
	for i in range(0, n - 1):
		if i == 0:
			ln = l[0]
			if abs(l[i] - l[i + 1]) > 1:
				bol = False
				break
		elif abs(l[i] - l[i - 1]) <= 1 and abs(l[i] - l[i + 1]) <= 1:
			ln = l[i]
		else:
			bol = False
			break
	print('YES') if bol else print('NO')


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


T = int(input())
for i in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	count = 0
	j = 0
	for i in range(N - 1):
		if abs(A[i] - A[i + 1]) <= 1:
			count += 1
		else:
			break
	if count == N - 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()
	s = 0
	for j in range(n - 1):
		if abs(l[j] - l[j + 1]) > 1:
			print('NO')
			s = 1
			break
	if s == 0:
		print('YES')


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


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


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 abs(l[i] - l[i + 1]) > 1:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	N = int(input())
	A = sorted(list(map(int, input().split())))
	res = True
	for i in range(N - 1):
		if abs(A[i] - A[i + 1]) <= 1:
			pass
		else:
			res = False
			break
	print('YES') if res else print('NO')


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


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


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


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


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


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


for _ in range(int(input())):
	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:
			continue
		else:
			flag = False
			break
	if flag:
		print('YES')
	else:
		print('NO')


for x in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	check = True
	for y in range(n):
		if y == 0:
			if arr[y] - arr[y + 1] > 1:
				check = False
				break
		elif y == n - 1:
			if arr[y] - arr[y - 1] > 1:
				check = False
				break
		elif arr[y] - arr[y - 1] > 1 or arr[y] - arr[y + 1] > 1:
			check = False
			break
	if check:
		print('YES')
	else:
		print('NO')


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


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


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


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


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


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


for T in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	i_0 = None
	flag = 0
	for i in range(len(A)):
		if i == 0:
			pass
		elif A[i] - A[i_0] > 1:
			flag = 1
			break
		i_0 = i
	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()))
	i = 0
	flag = True
	while i <= n - 2:
		if abs(a[i] - a[i + 1]) > 1:
			flag = False
			break
		i += 1
	if flag == True:
		print('YES')
	else:
		print('NO')


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


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


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


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


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


t = int(input())
for i in range(t):
	a = int(input())
	b = list(map(int, input().split()))
	d = []
	g = 1
	for x in b:
		if x not in d:
			d.append(x)
	d.sort()
	for e in range(len(d) - 1):
		if d[e] - d[e + 1] != -1:
			g = 0
			print('NO')
			break
	if g == 1:
		print('YES')