One of the SWERC judges has a dog named Boy. Besides being a good competitive programmer, Boy loves fresh air, so she wants to be walked at least twice a day. Walking Boy requires $120$ consecutive minutes. Two walks cannot overlap, but one can start as soon as the previous one has finished.

Boy before and after getting ACCEPTED on this problem.

Today, the judge sent $n$ messages to the SWERC Discord server. The $i$-th message was sent $a_i$ minutes after midnight. You know that, when walking Boy, the judge does not send any messages, but he can send a message right before or right after a walk. Is it possible that the judge walked Boy at least twice today?

Note that a day has $1440$ minutes, and a walk is considered to happen today if it starts at a minute $s \ge 0$ and ends right before a minute $e \le 1440$. In that case, it must hold that $e - s = 120$ and, for every $i = 1, \, 2 \, \dots, \, n$, either $a_i \le s$ or $a_i \ge e$.


-----Input-----

Each test contains multiple test cases. The first line contains an integer $t$ ($1 \le t \le 100$) — the number of test cases. The descriptions of the $t$ test cases follow.

The first line of each test case contains an integer $n$ ($1 \le n \le 100$) — the number of messages sent by the judge.

The second line of each test case contains $n$ integers $a_1, \, a_2, \, \dots, \, a_n$ ($0 \le a_1 < a_2 < \cdots < a_n < 1440$) — the times at which the messages have been sent (in minutes elapsed from midnight).


-----Output-----

For each test case, output one line containing ${YES}$ if it is possible that Boy has been walked at least twice, and ${NO}$ otherwise.


-----Examples-----

Input
6
14
100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400
12
100 200 300 400 600 700 800 900 1100 1200 1300 1400
13
100 200 300 400 500 600 700 800 900 1100 1200 1300 1400
13
101 189 272 356 463 563 659 739 979 1071 1170 1274 1358
1
42
5
0 1 2 3 4
Output
NO
YES
NO
YES
YES
YES


-----Note-----

In the first test case, the judge has sent a message at each time multiple of $100$ (excluding $0$). It is impossible that he has walked Boy even once.

In the second test case, the times are the same as above, but $500$ and $1000$ are missing. The judge could have walked Boy, for instance, during the time intervals $[440, 560]$ and $[980, 1100]$. The situation is illustrated in the picture below, where the walks are represented by green intervals.

$$$$

In the third test case, the times are the same as in the first test case, but $1000$ is missing. The judge could have walked Boy at most once.

In the fourth test case, Boy could have been walked during the time intervals $[739, 859]$ and $[859, 979]$.

Difficulty: EASY

Solutions:
num = int(input())
task = []
for i in range(num):
	x = 0
	amount = int(input())
	data = [x for x in map(int, input().split())]
	if data[-1] < 1440:
		data.append(1440)
	if data[-1] > 1440:
		data.append(data[-1] - 1440)
	if data[0] > 0:
		data.insert(0, 0)
	for j in range(len(data) - 1):
		if data[j + 1] - data[j] >= 120:
			x += 1
		if data[j + 1] - data[j] >= 240:
			x += 2
	if x >= 2:
		task.append('YES')
	else:
		task.append('NO')
print(*task, sep='\n')


t = int(input())
for i in range(t):
	x = input()
	L = [int(x) for x in input().split()]
	L.append(1440)
	L = [0] + L
	curr = 0
	ans = 0
	for i in L:
		ans += (i - curr) // 120
		curr = i
	if ans > 1:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
T = int(input())
printf = sys.stdout.write
imprimir = ''
for i in range(T):
	N = int(input())
	numbers = input().split()
	numbers.append(1440)
	numbers.insert(0, 0)
	sol = 0
	for pos in range(1, N + 2):
		sol += (int(numbers[pos]) - int(numbers[pos - 1])) // 120
	if sol >= 2:
		imprimir = imprimir + 'YES'
	else:
		imprimir = imprimir + 'NO'
	if not i == T - 1:
		imprimir = imprimir + '\n'
printf(imprimir)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	k = 0
	prev = 0
	for i in a:
		k = k + (i - prev) // 120
		prev = i
	k = k + (1440 - prev) // 120
	if k >= 2:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	length = int(input())
	times = [0] + list(map(int, input().split())) + [1440]
	count = 0
	for i in range(length + 1):
		count += (times[i + 1] - times[i]) // 120
	if count >= 2:
		print('YES')
	else:
		print('NO')


def fun(n, a):
	count = 0
	count += a[0] // 120
	for i in range(len(a) - 1):
		count += (a[i + 1] - a[i]) // 120
	count += (1440 - a[-1]) // 120
	return 'YES' if count >= 2 else 'NO'
assert fun(14, [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400]) == 'NO'
assert fun(12, [100, 200, 300, 400, 600, 700, 800, 900, 1100, 1200, 1300, 1400]) == 'YES'
assert fun(13, [100, 200, 300, 400, 500, 600, 700, 800, 900, 1100, 1200, 1300, 1400]) == 'NO'
assert fun(13, [101, 189, 272, 356, 463, 563, 659, 739, 979, 1071, 1170, 1274, 1358]) == 'YES'
assert fun(1, [42]) == 'YES'
assert fun(5, [0, 1, 2, 3, 4]) == 'YES'
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(fun(n, a))


for _ in range(int(input())):
	a = int(input())
	x = list(map(int, input().split()))
	x.append(1440)
	count = 0
	if a <= 12:
		print('YES')
	else:
		for i in range(a):
			count += (x[i + 1] - x[i]) // 120
		if count >= 2:
			print('YES')
		else:
			print('NO')


n = int(input())
for i in range(n):
	c = 0
	k = 0
	a = int(input())
	x = list(map(int, input().split()))
	x.reverse()
	x.append(0)
	x.reverse()
	x.append(1440)
	t = []
	for j in range(len(x)):
		t.append(x[j] - x[j - 1])
	for f in t:
		if f >= 240:
			k += 1
		elif f >= 120 and f < 240:
			c += 1
	if c >= 2 or k >= 1:
		print('YES')
	else:
		print('NO')


noOfTestCases = int(input())
noOfMsg = 0
timeOfMSgSent = []
noOfWalks = 0
for i in range(0, noOfTestCases):
	noOfWalks = 0
	noOfMsg = int(input())
	timeOfMSgSent = list(map(int, input().split(' ')))
	if len(timeOfMSgSent) == 1 and timeOfMSgSent[0] <= 1200:
		print('YES')
	else:
		for i in range(len(timeOfMSgSent) - 1):
			if timeOfMSgSent[i + 1] - timeOfMSgSent[i] >= 120:
				if timeOfMSgSent[i + 1] - timeOfMSgSent[i] >= 240:
					noOfWalks += 2
				else:
					noOfWalks += 1
		if noOfWalks < 2 and (timeOfMSgSent[-1] <= 1200 or timeOfMSgSent[0] >= 240):
			print('YES')
		elif noOfWalks >= 2:
			print('YES')
		else:
			print('NO')


k = int(input())
res = []
while k > 0:
	cur = 0
	found = False
	_ = input()
	x = input().split(' ')
	arr = [0]
	for num in x:
		arr.append(int(num))
	arr.append(1440)
	res.append(False)
	for i in range(1, len(arr)):
		cur += int((arr[i] - arr[i - 1]) / 120)
		if cur >= 2:
			res.pop()
			res.append(True)
			found = True
			break
	k -= 1
for i in res:
	if i:
		print('YES')
	else:
		print('NO')


test = int(input())
final = []
final_arr = []
for i in range(test):
	contador = 0
	inputo = int(input())
	lista_valores = input()
	lista_valores = lista_valores.split()
	for i in range(len(lista_valores)):
		lista_valores[i] = int(lista_valores[i])
	lista_valores_final = []
	for i in range(len(lista_valores)):
		if i == 0:
			lista_valores_final.append(lista_valores[i])
		else:
			lista_valores_final.append(lista_valores[i] - lista_valores[i - 1])
	lista_valores_final.append(1440 - lista_valores[len(lista_valores) - 1])
	final_arr.append(lista_valores_final)
	for i in range(len(lista_valores_final)):
		if lista_valores_final[i] >= 120 and lista_valores_final[i] < 240:
			contador += 1
		if lista_valores_final[i] >= 240:
			contador += 2
	if contador >= 2:
		final.append('YES')
	else:
		final.append('NO')
for k in range(len(final)):
	print(final[k])


def lst_to_int(x):
	y = []
	for i in x:
		y.append(int(i))
	return y
for i in range(int(input())):
	input()
	lst = ['0'] + input().split()
	lst.append('1440')
	lst = lst_to_int(lst)
	t = 0
	for j in range(len(lst) - 1):
		if lst[j + 1] - lst[j] >= 120:
			t += (lst[j + 1] - lst[j]) // 120
	if t >= 2:
		print('YES')
	else:
		print('NO')


h = []
for i in range(int(input())):
	n = int(input())
	r = 0
	a = list(map(int, input().split()))
	for i in range(n - 1):
		if a[i + 1] - a[i] >= 120:
			r += (a[i + 1] - a[i]) // 120
	if a[0] >= 120:
		r += a[0] // 120
	if 1440 - a[-1] >= 120:
		r += (1440 - a[-1]) // 120
	if r > 1:
		h.append('YES')
	else:
		h.append('NO')
for z in h:
	print(z)


t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	walking = 0
	if A[0] >= 240 or A[-1] <= 1200 or len(A) <= 12:
		print('YES')
	else:
		for i in range(n - 1):
			s = A[i]
			e = A[i + 1]
			walking += (e - s) // 120
		if walking >= 2:
			print('YES')
		else:
			print('NO')


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


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = 0
	if 1440 - a[-1] >= 240:
		print('YES')
	elif a[0] >= 240:
		print('YES')
	else:
		for i in range(len(a) - 1):
			w = a[i + 1] - a[i]
			if w >= 120:
				r = w // 120
				c += r
		if c >= 2:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if a[0] != 0:
		a.insert(0, 0)
	if a[-1] != 1440:
		a.append(1440)
	cnt = 0
	for i in range(len(a) - 1):
		cnt += (a[i + 1] - a[i]) // 120
	print('YES' if cnt >= 2 else 'NO')


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


t = int(input())
for ole in range(t):
	n = int(input())
	L = [int(x) for x in input().split()]
	count = 0
	x = 1440
	L.append(x)
	if L[0] - 0 >= 240:
		count += 2
	elif L[0] >= 120:
		count += 1
	for i in range(n):
		if L[i + 1] - L[i] >= 240:
			count += 2
		elif L[i + 1] - L[i] >= 120:
			count += 1
		if count >= 2:
			print('YES')
			break
	if count < 2:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	arr = [0] + list(map(int, input().split())) + [1440]
	ans = 0
	for i in range(n + 1):
		ans += (arr[i + 1] - arr[i]) // 120
	if ans >= 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, a) = (int(input()), [int(i) for i in input().split()])
	a = [0] + a + [1440]
	res = sum(((a[i + 1] - a[i]) // 120 for i in range(len(a) - 1)))
	res = 'YES' if res > 1 else 'NO'
	print(res)


for _ in range(int(input())):
	_ = input()
	messages = [0] + list(map(int, input().split())) + [1440]
	boy_walk = 0
	for i in range(1, len(messages)):
		if messages[i] - messages[i - 1] >= 240:
			boy_walk = 2
			break
		if messages[i] - messages[i - 1] >= 120:
			boy_walk += 1
	print('YES' if boy_walk >= 2 else 'NO')


for _ in range(int(input())):
	n = int(input())
	k = [int(i) for i in input().split()]
	res = k[0] // 120
	for i in range(1, n):
		res += (k[i] - k[i - 1]) // 120
	res += (1440 - k[-1]) // 120
	if res > 1:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	k = int(input())
	l1 = list(map(int, input().split()))
	l2 = []
	for j in range(k):
		if j == 0:
			if l1[0] >= 120:
				if l1[0] >= 240:
					l2.append(1)
					l2.append(1)
				else:
					l2.append(1)
		elif l1[j] - l1[j - 1] >= 120:
			if l1[j] - l1[j - 1] >= 240:
				l2.append(1)
				l2.append(1)
			else:
				l2.append(1)
	if 1440 - l1[k - 1] >= 120:
		if 1440 - l1[k - 1] >= 240:
			l2.append(1)
			l2.append(1)
		else:
			l2.append(1)
	if len(l2) >= 2:
		print('YES')
	else:
		print('NO')


abc = int(input())
for p in range(abc):
	a = int(input())
	b = list(input().split())

	def walk():
		if a <= 10:
			print('YES')
		elif int(b[a - 1]) <= 1200:
			print('YES')
		elif int(b[0]) >= 240:
			print('YES')
		elif a > 10 and int(b[a - 1]) > 1200 and (int(b[0]) < 240):
			walkcount = 0
			if int(b[0]) >= 120 and int(b[0]) < 240:
				walkcount += 1
			for i in range(a - 1):
				if int(b[i + 1]) - int(b[i]) >= 120 and int(b[i + 1]) - int(b[i]) < 240:
					walkcount += 1
				elif int(b[i + 1]) - int(b[i]) >= 240:
					walkcount += 2
				else:
					walkcount += 0
			if walkcount >= 2:
				print('YES')
			else:
				print('NO')
	walk()


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


for _ in range(int(input())):
	n = int(input())
	count = 0
	l = [0] + [*map(int, input().split())] + [1440]
	for i in range(n + 1):
		count += (l[i + 1] - l[i]) // 120
	if count >= 2:
		print('YES')
	else:
		print('NO')


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


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split(' ')))
	m = 0
	c = 0
	m = l[0]
	if m >= 240:
		c += 2
		print('YES')
	elif m >= 120:
		c += 1
	if n >= 2:
		for i in range(1, n):
			m = l[i] - l[i - 1]
			if m >= 240:
				c += 2
				print('YES')
				break
			elif m >= 120:
				c += 1
				if c >= 2:
					print('YES')
					break
	if c < 2:
		m = 1440 - l[n - 1]
		if m >= 240:
			print('YES')
		elif m >= 120:
			c += 1
			if c >= 2:
				print('YES')
		elif c < 2:
			print('NO')


ans = []
for _ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.append(0)
	arr.append(1440)
	arr.sort()
	walks = 0
	for i in range(0, n + 1):
		if walks < 2 and abs(arr[i] - arr[i + 1]) >= 240:
			walks += 2
			break
		elif walks < 2 and abs(arr[i] - arr[i + 1]) >= 120:
			walks += 1
		if walks >= 2:
			break
	if walks >= 2:
		ans.append('YES')
	else:
		ans.append('NO')
for i in range(0, len(ans)):
	print(ans[i])


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = 0
	flag = False
	for i in range(n - 1):
		delta = a[i + 1] - a[i]
		if 240 > delta >= 120:
			c += 1
			if c >= 2:
				flag = True
				break
		elif delta >= 240:
			flag = True
			break
	if 240 > 1440 - a[n - 1] >= 120:
		c += 1
		if c >= 2:
			flag = True
	elif 1440 - a[n - 1] >= 240:
		flag = True
	if 120 <= a[0] < 240:
		c += 1
		if c >= 2:
			flag = True
	elif a[0] >= 240:
		flag = True
	if flag:
		print('YES')
	else:
		print('NO')


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


for i in range(int(input())):
	n = int(input())
	times = list(map(int, input().split()))
	times.insert(0, 0)
	times.append(1440)
	b = 0
	for i in range(len(times) - 1):
		if times[i + 1] - times[i] >= 120:
			b = b + (times[i + 1] - times[i]) // 120
	print('YES' if b >= 2 else 'NO')


t = int(input())
for _ in range(t):
	n = int(input())
	li = [int(s) for s in input().split()]
	count = 0
	if li[0] - 0 >= 120:
		count += 1
	if li[0] - 0 >= 240:
		count += 1
	if 1440 - li[n - 1] >= 120:
		count += 1
	if 1440 - li[n - 1] >= 240:
		count += 1
	for i in range(n - 1, 0, -1):
		if li[i] - li[i - 1] >= 120:
			count += 1
		if li[i] - li[i - 1] >= 240:
			count += 1
	if count >= 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	c = 0
	for i in range(len(a) - 1):
		if a[i + 1] - a[i] >= 240:
			c = 2
			break
		elif a[i + 1] - a[i] >= 120:
			c += 1
		if c >= 2:
			break
	if a[0] >= 240 or 1440 - a[-1] >= 240:
		c = 2
	elif a[0] >= 120 or 1440 - a[-1] >= 120:
		c += 1
	if c >= 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.append(1440)
	new = [0]
	for j in range(1, n + 2):
		new.append(arr[j - 1])
	c = 0
	p = 0
	for ii in range(n + 1):
		if new[ii + 1] - new[ii] >= 240:
			p = 1
			break
		if new[ii + 1] - new[ii] >= 120:
			c = c + 1
			if c == 2:
				p = 1
				break
	if p != 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	N = int(input())
	A = [0] + list(map(int, input().split())) + [1440]
	ANS = 0
	for i in range(N + 1):
		ANS += (A[i + 1] - A[i]) // 120
	if ANS >= 2:
		print('YES')
	else:
		print('NO')


def pos_two_walks(liste):
	count_1 = 0
	count_2 = 0
	liste.append(0)
	liste.append(1440)
	sort_liste = sorted(liste)
	for i in range(1, len(sort_liste)):
		if sort_liste[i] - sort_liste[i - 1] >= 240:
			count_2 += 1
		if sort_liste[i] - sort_liste[i - 1] >= 120:
			count_1 += 1
	if count_2 > 0 or count_1 > 1:
		print('YES')
	else:
		print('NO')
tests = int(input())
for i in range(tests):
	length = int(input())
	pos_two_walks(list(map(int, input().split(' '))))


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 print_result():
	for i in result:
		print(i)
number_test_case = inp()
result = []
for i in range(number_test_case):
	count = 0
	number_message = inp()
	times = [0] + inlt() + [1440]
	for i in times:
		if i > 1440:
			times.pop(times.index(i))
	for i in range(len(times) - 1):
		count = count + (times[i + 1] - times[i]) // 120
	if int(count) >= 2:
		result.append('YES')
	else:
		result.append('NO')
	times = []
print_result()


n = int(input())
a = []
c = []
count = 0
for j in range(n):
	t = int(input())
	a = list(map(int, input().strip().split()))[:t]
	if max(a) <= 1200:
		count = count + 2
	if min(a) >= 240:
		count = count + 2
	for i in range(t - 1):
		if a[i + 1] - a[i] >= 240:
			count = count + 2
		elif a[i + 1] - a[i] >= 120:
			count = count + 1
	c.append(count)
	count = 0
for k in range(n):
	if c[k] > 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	if n < 8:
		print('YES')
		continue
	out = arr[0] // 120 + (1440 - arr[-1]) // 120
	for x in range(1, n):
		out += (arr[x] - arr[x - 1]) // 120
	if out >= 2:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	x = input()
	line = [int(x) for x in input().split()]
	line.append(1440)
	line = [0] + line
	cur = 0
	ans = 0
	for i in line:
		ans += (i - cur) // 120
		cur = i
	if ans > 1:
		print('YES')
	else:
		print('NO')


from math import floor
t = int(input())
for i in range(t):
	x = int(input())
	arr = list(map(int, input().split()))
	arr.insert(0, 0)
	arr.append(1440)
	count = 0
	for i in range(len(arr) - 1):
		diff = arr[i + 1] - arr[i]
		if diff >= 120:
			count += floor(int(diff / 120))
	if count >= 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	input()
	a = list(map(int, input().split()))
	kont = a[0] // 120
	for i in range(len(a) - 1):
		kont += (a[i + 1] - a[i]) // 120
	kont += (1440 - a[-1]) // 120
	if kont >= 2:
		print('YES')
	else:
		print('NO')


cases = int(input())

def walk(times):
	count = 0
	k = times[0] // 120
	l = (1440 - times[-1]) // 120
	count = k + l
	if count >= 2:
		return 'YES'
	else:
		for i in range(len(times) - 1):
			count += (times[i + 1] - times[i]) // 120
			if count >= 2:
				return 'YES'
	return 'NO'
for i in range(cases):
	n = int(input())
	times = list(map(int, input().split()))
	print(walk(times))


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.insert(0, 0)
	arr.append(1440)
	ans = 0
	for i in range(1, len(arr)):
		if (arr[i] - arr[i - 1]) // 120 > 0:
			ans += (arr[i] - arr[i - 1]) // 120
			if ans >= 2:
				print('YES')
				break
	else:
		print('NO')


import sys
input = sys.stdin.readline
cases = int(input())
for _ in range(cases):
	length = input()
	times = [0]
	times.extend(list(map(int, input().split())))
	times.append(1440)
	free_interval = 0
	for (pre, cur) in zip(times, times[1:]):
		free_interval += (cur - pre) // 120
	if free_interval >= 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	c = []
	c.append(a[0] // 120)
	for i in range(n - 1):
		z = a[i + 1] - a[i]
		if z // 120 >= 1:
			c.append(z // 120)
	if sum(c) <= 1:
		if (1440 - max(a)) // 120 + sum(c) >= 2:
			print('YES')
		else:
			print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	res = 'NO'
	n = int(input())
	a = list(map(int, input().split()))
	r = 2
	if a[-1] + 240 <= 1440:
		res = 'YES'
	elif a[0] >= 240:
		res = 'YES'
	else:
		if a[-1] + 120 <= 1440:
			r -= 1
			if r <= 0:
				res = 'YES'
		if a[0] >= 120:
			r -= 1
			if r <= 0:
				res = 'YES'
		for i in range(n - 1):
			if r <= 0:
				res = 'YES'
				break
			if a[i + 1] - a[i] >= 240:
				r -= 2
			elif a[i + 1] - a[i] >= 120:
				r -= 1
			if r <= 0:
				res = 'YES'
				break
	print(res)


for t in range(int(input())):
	m = int(input())
	s = [0] + [int(x) for x in input().split()] + [1440]
	s = list(map(lambda x: x[1] - x[0], zip(s[:-1], s[1:])))
	if sum(list(filter(lambda x: x >= 120, s))) >= 240:
		print('YES')
	else:
		print('NO')


T = int(input())
for t in range(T):
	N = int(input())
	nums = [0] + [int(x) for x in input().split()] + [1440]
	ans = 0
	for i in range(N + 1):
		if nums[i + 1] - nums[i] >= 240:
			ans += 2
		elif nums[i + 1] - nums[i] >= 120:
			ans += 1
	print('YES' if ans // 2 else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	k = 0
	for j in range(len(a)):
		if j == 0:
			b = a[j]
		else:
			b = a[j] - a[j - 1]
		if 240 > b >= 120:
			k = k + 1
		elif b >= 240:
			k = k + 2
	b = 1440 - a[j]
	if 240 > b >= 120:
		k = k + 1
	elif b >= 240:
		k = k + 2
	if k >= 2:
		print('YES')
	else:
		print('NO')


t = int(input())
ls = []
for j in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a = [0] + a + [1440]
	ans = 0
	for i in range(n + 1):
		ans = ans + (a[i + 1] - a[i]) // 120
		if ans >= 2:
			break
	if ans >= 2:
		ls.append('YES')
	else:
		ls.append('NO')
for k in range(t):
	print(ls[k])


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


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


for _ in range(int(input())):
	g = input()
	lst = list(map(int, input().split()))
	lst.append(0)
	lst.append(1440)
	lst = sorted(lst)
	f = 0
	for i in range(len(lst) - 1):
		f += (lst[i + 1] - lst[i]) // 120
	if f > 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	if l[0] != 0:
		l = [0] + l
	if l[-1] != 1440:
		l.append(1440)
	s = sum(((l[i + 1] - l[i]) // 120 for i in range(len(l) - 1)))
	print('YES' * int(s >= 2) + 'NO' * int(s < 2))


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	if l[0] != 0:
		l.insert(0, 0)
	if l[-1] != 1440:
		l.append(1440)
	c = 0
	for i in range(len(l) - 1):
		s = l[i + 1] - l[i]
		if s >= 240:
			c += 2
		elif s >= 120:
			c += 1
	if c >= 2:
		print('YES')
	else:
		print('NO')


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


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr1 = [0] * 1439
	for i in range(n):
		arr1[arr[i]] = 1
	s = ''
	for i in arr1:
		s += str(i)
	if s.count('0' * 119) >= 2:
		print('YES')
	else:
		print('NO')