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: introductory

Starter code:

Solutions:
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")


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)

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

"""
                            pppppppppppppppppppp
                         ppppp  ppppppppppppppppppp
                      ppppppp    ppppppppppppppppppppp
                      pppppppp  pppppppppppppppppppppp
                      pppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppppp
       ppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppp
      pppppppppppppppppppppppppppppppppppppppppppppppp  ppppppppppppppppppppp
     ppppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppppp
    ppppppppppppppppppppppppppppppppppppppppppppppp    pppppppppppppppppppppppp
   pppppppppppppppppppppppppppppppppppppppppppppp     pppppppppppppppppppppppppp
  ppppppppppppppppppppppppppppppppppppppppppppp      pppppppppppppppppppppppppppp
  pppppppppppppppppppppppppppppppp               pppppppppppppppppppppppppppppppp
  pppppppppppppppppppppppppppp     pppppppppppppppppppppppppppppppppppppppppppppp
  ppppppppppppppppppppppppppp    pppppppppppppppppppppppppppppppppppppppppppppppp
    pppppppppppppppppppppppp  pppppppppppppppppppppppppppppppppppppppppppppppppp
     ppppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppppp
      pppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppp
       ppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppppp
                              pppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppp  pppppppp
                              ppppppppppppppppppppp    ppppppp
                                 ppppppppppppppppppp  ppppp
                                    pppppppppppppppppppp
"""


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
# sys.setrecursionlimit(pow(10, 6))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
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 list(map(int, data().split()))
def ssp(): return list(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])


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")

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")


# Author: S Mahesh Raju
# Username: maheshraju2020
# Date: 05/08/2020

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')
            


import sys
input = sys.stdin.readline

for _ in range(int(input())):
    n=int(input())
    L=list(map(int,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())):
    n = int(input())
    arr = list(map(int, input().split()))
    arr.sort()
    flag = 0
    for i in range(n - 1):
        if arr[i + 1] - arr[i] > 1:
            flag = 1
            break
    if flag:
        print("NO")
    else:
        print("YES")

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

import math

T = int(input())

for i in range(T):
  n = int(input())
  #n,k = map(int, input().split())
  a = list(map(int,input().split()))
  #a = input()
  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')
  


from sys import stdin,stdout
import math
from collections import Counter,defaultdict
LI=lambda:list(map(int,input().split()))
MAP=lambda:list(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()
                


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)

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


#!/usr/bin/env python3
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


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

t = int(input())
for _ in range(t):
    solve()

from sys import stdin, stdout  
 
t=int(stdin.readline())
for _ in range(t):
    n=int(stdin.readline() )
    #n,x=(map(int, stdin.readline().strip().split()))
    arr=list(map(int, stdin.readline() .strip().split()))
    #s=input()

    #stdout.write(str(cp))
    #stdout.write("\n")

    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")


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")

for _ in range(int(input())):
    n = int(input())
    #n, k = map(int, input().split())
    a = list(map(int, input().split()))
    a.sort()
    s=1 
    for i in range(n-1):
        if(abs(a[i]-a[i+1])>1):
            s=0 
    if(s==1):
        print("YES")
    else:
        print("NO")

import sys
# from collections import deque
# from collections import Counter
# from math import sqrt
# from math import log
# from math import ceil
# from bisect import bisect_left, bisect_right

# alpha=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
# mod=10**9+7
# mod=998244353

# def BinarySearch(a,x): 
# 	i=bisect_left(a,x) 
# 	if(i!=len(a) and a[i]==x): 
# 		return i 
# 	else: 
# 		return -1

# 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
# 	prime[0]=False
# 	prime[1]=False
# 	s=set()
# 	for i in range(len(prime)):
# 		if(prime[i]):
# 		s.add(i)
# 	return s

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

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 _ 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]>=2):
            ans = "NO"
            break
    print(ans)