Chef wants to organize a contest. Predicting difficulty levels of the problems can be a daunting task. Chef wants his contests to be balanced in terms of difficulty levels of the problems.
Assume a contest had total P participants. A problem that was solved by at least half of the participants (i.e. P / 2 (integer division)) is said to be cakewalk difficulty. A problem solved by at max P / 10 (integer division) participants is categorized to be a hard difficulty.
Chef wants the contest to be balanced. According to him, a balanced contest must have exactly 1 cakewalk and exactly 2 hard problems. You are given the description of N problems and the number of participants solving those problems. Can you tell whether the contest was balanced or not?

-----Input-----
The first line of the input contains an integer T denoting the number of test cases.
The first line of each test case contains two space separated integers, N, P denoting the number of problems, number of participants respectively.
The second line contains N space separated integers, i-th of which denotes number of participants solving the i-th problem.

-----Output-----
For each test case, output "yes" or "no" (without quotes) denoting whether the contest is balanced or not.

-----Constraints-----
- 1 ≤ T, N ≤ 500 
- 1 ≤ P ≤ 108 
- 1 ≤ Number of participants solving a problem ≤ P

-----Subtasks-----
- Subtask #1 (40 points): P is a multiple of 10
- Subtask #2 (60 points): Original constraints

-----Example-----
Input
6
3 100
10 1 100
3 100
11 1 100
3 100
10 1 10
3 100
10 1 50
4 100
50 50 50 50
4 100
1 1 1 1

Output
yes
no
no
yes
no
no

-----Explanation-----
Example case 1.: The problems are of hard, hard and cakewalk difficulty. There is 1 cakewalk and 2 hard problems, so the contest is balanced.
Example case 2.: The second problem is hard and the third is cakewalk. There is 1 cakewalk and 1 hard problem, so the contest is not balanced.
Example case 3.: All the three problems are hard. So the contest is not balanced.
Example case 4.: The problems are of hard, hard, cakewalk difficulty. The contest is balanced.
Example case 5.: All the problems are cakewalk. The contest is not balanced.
Example case 6.: All the problems are hard. The contest is not balanced.

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
for i in range(int(input())):
	(n, p) = map(int, input().split())
	t = list(map(int, input().split()))
	d = int(p / 2)
	f = int(p / 10)
	g = int(n / 2)
	count = 0
	l = 0
	for j in range(len(t)):
		if t[j] >= d:
			count += 1
		elif t[j] <= f:
			l += 1
	if count == 1 and l == 2:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(N, P) = map(int, input().split())
	A = list(map(int, input().split()))
	(cw, hard) = (0, 0)
	for a in A:
		cw += P // 2 <= a
		hard += P // 10 >= a
	if cw == 1 and hard == 2:
		print('yes')
	else:
		print('no')


t = int(input())
while t > 0:
	c = 0
	h = 0
	(n, p) = map(int, input().split(' '))
	a = list(map(int, input().split(' ')))
	for i in a:
		if i >= p // 2:
			c += 1
		elif i <= p // 10:
			h += 1
	if c == 1 and h == 2:
		print('yes')
	else:
		print('no')
	t -= 1


t = int(input())
while t:
	(N, P) = map(int, input().split())
	A = list(map(int, input().split()))
	e = 0
	h = 0
	for i in A:
		if i >= P // 2:
			e += 1
		elif i <= P // 10:
			h += 1
	if P == 1:
		print('no')
	elif e == 1 and h == 2:
		print('yes')
	else:
		print('no')
	t = t - 1


val = int(input())
for i in range(val):
	(n, p) = input().split()
	n = int(n)
	p = int(p)
	di = int(0)
	ca = int(0)
	q = list(map(int, input().split()))
	for j in range(len(q)):
		d = p / 10
		c = p / 2
		if q[j] <= d:
			di = di + 1
		elif c <= q[j]:
			ca = ca + 1
	if ca == 1 and di == 2:
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	(n, p) = map(int, input().split())
	l = list(map(int, input().split()))
	cakewalk = hard = 0
	for i in l:
		if i >= p // 2:
			cakewalk += 1
		if i <= p // 10:
			hard += 1
	if cakewalk == 1 and hard == 2:
		print('yes')
	else:
		print('no')


t = int(input())
for i in range(t):
	(n, p) = map(int, input().split())
	z = list(map(int, input().split()))
	(k, q) = (0, 0)
	for i in z:
		if i >= p // 2:
			k += 1
		elif i <= p // 10:
			q += 1
	if k == 1 and q == 2:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(N, P) = map(int, input().split())
	l = list(map(int, input().split()))

	def checkeasy(x):
		if x >= P // 2:
			return True
		else:
			return False

	def checkhard(x):
		if x <= P // 10:
			return True
		else:
			return False
	eg = list(filter(checkeasy, l))
	hg = list(filter(checkhard, l))
	if len(eg) == 1 and len(hg) == 2:
		print('yes')
	else:
		print('no')


T = int(input())
for i in range(T):
	(n, p) = map(int, input().split())
	solving = list(map(int, input().split()))
	hard = 0
	cake = 0
	c = p // 2
	d = p // 10
	for j in range(n):
		if solving[j] >= c:
			cake = cake + 1
		elif solving[j] <= d:
			hard = hard + 1
	if cake == 1 and hard == 2:
		print('yes')
	else:
		print('no')


try:
	t = int(input())
	for i in range(t):
		(n, p) = list(map(int, input().split(' ')))
		z = list(map(int, input().split()))
		e = 0
		d = 0
		for j in z:
			if j >= int(p / 2):
				e = e + 1
			elif j <= int(p / 10):
				d = d + 1
		if e == 1 and d == 2:
			print('yes')
		else:
			print('no')
except:
	pass


T = int(input())
for _ in range(T):
	(n, p) = tuple(map(int, input().split(' ')))
	solved_by = list(map(int, input().split(' ')))
	(cakewalk, hard) = (0, 0)
	for x in solved_by:
		if x >= p // 2:
			cakewalk = cakewalk + 1
		elif x <= p // 10:
			hard = hard + 1
	if cakewalk == 1 and hard == 2:
		print('yes')
	else:
		print('no')


t = int(input())
for dummy in range(t):
	(n, p) = map(int, input().split())
	solvers = list(map(int, input().split()))
	easy = 0
	hard = 0
	for s in solvers:
		if s >= p // 2:
			easy += 1
			if easy > 1:
				break
		elif s <= p // 10:
			hard += 1
			if hard > 2:
				break
	if easy == 1 and hard == 2:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(n, p) = map(int, input().split())
	n_arr = list(map(int, input().split()))
	(hrd, cw) = (0, 0)
	for i in range(n):
		if n_arr[i] >= p // 2:
			cw += 1
		elif n_arr[i] <= p // 10:
			hrd += 1
	if hrd == 2 and cw == 1:
		print('yes')
	else:
		print('no')


for t in range(int(input())):
	(n, p) = list(map(int, input().split()))
	ls = list(map(int, input().split()))
	count = 0
	cout = 0
	for j in ls:
		if j <= p // 10:
			count += 1
		if j >= p // 2:
			cout += 1
	if count == 2 and cout == 1:
		print('yes')
	else:
		print('no')


T = int(input())
for t in range(T):
	(a, b) = map(int, input().split())
	x = list(map(int, input().split()))
	hard = 0
	cakewalk = 0
	for i in range(a):
		if x[i] <= b // 10:
			hard = hard + 1
		elif x[i] >= b // 2:
			cakewalk = cakewalk + 1
	if cakewalk == 1 and hard == 2:
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	(n, p) = map(int, input().split())
	a = list(map(int, input().split()))
	half = p // 2
	tenth = p // 10
	(cake, hard) = (0, 0)
	for i in a:
		if i >= half:
			cake += 1
		elif i <= tenth:
			hard += 1
	if cake == 1 and hard == 2:
		print('yes')
	else:
		print('no')


for t in range(int(input())):
	(N, P) = map(int, input().split())
	l = list(map(int, input().strip().split()))
	a = b = 0
	for j in l:
		if j >= int(P / 2):
			a += 1
		elif j <= int(P / 10):
			b += 1
	if a == 1 and b == 2:
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	(n, x) = map(int, input().split())
	l = list(map(int, input().split()))
	a = x // 10
	b = x // 2
	counta = 0
	countb = 0
	for i in l:
		if i in range(1, a + 1):
			counta += 1
		elif i in range(b, x + 1):
			countb += 1
		else:
			continue
	if counta == 2 and countb == 1:
		print('yes')
	else:
		print('no')


for T in range(int(input())):
	(n, p) = map(int, input().split())
	li = list(map(int, input().split()))
	ck = p // 2
	ch = p // 10
	(k, h) = (0, 0)
	for i in range(n):
		if li[i] >= ck:
			k += 1
		elif li[i] <= ch:
			h += 1
	if k == 1 and h == 2:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(n, p) = map(int, input().split())
	l = list(map(int, input().split()))
	pcw = int(p / 2)
	ph = int(p / 10)
	cw = 0
	h = 0
	for num in l:
		if num >= pcw:
			cw += 1
		elif num <= ph:
			h += 1
	if cw == 1 and h == 2:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(n, p) = list(map(int, input().split()))
	l = list(map(int, input().split()))
	(e, h) = (0, 0)
	for i in l:
		if i <= p // 10:
			h += 1
		elif i >= p // 2:
			e += 1
	if e == 1 and h == 2:
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	(n, p) = map(int, input().split())
	l = list(map(int, input().split()))
	r1 = int(p / 2)
	r2 = int(p / 10)
	l1 = list(filter(lambda x: x >= r1, l))
	l2 = list(filter(lambda x: x <= r2, l))
	if len(l1) == 1 and len(l2) == 2:
		print('yes')
	else:
		print('no')


for t in range(int(input())):
	(n_prb, n_prtcp) = map(int, input().split())
	n_p_s_p = list(map(int, input().split()))
	cakewalk_d = n_prtcp // 2
	hard_d = n_prtcp // 10
	(cw_d, h_d) = (0, 0)
	for i in n_p_s_p:
		if i >= cakewalk_d:
			cw_d += 1
		elif i <= hard_d:
			h_d += 1
	if cw_d == 1 and h_d == 2:
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	(x, p) = map(int, input().split())
	l = list(map(int, input().split()))
	a = b = 0
	for j in l:
		if j >= int(p / 2):
			a += 1
		elif j <= int(p / 10):
			b += 1
	print('yes' if a == 1 and b == 2 else 'no')


t = int(input())
for i in range(t):
	(n, p) = map(int, input().split())
	n1 = list(map(int, input().split()))
	c = 0
	d = 0
	for j in range(len(n1)):
		if n1[j] >= p // 2:
			c += 1
		elif n1[j] <= p // 10:
			d += 1
	if c == 1 and d == 2:
		print('yes')
	else:
		print('no')


x = int(input())
while x:
	(a, b) = map(int, input().split())
	k = list(map(int, input().split()))
	e = 0
	h = 0
	for i in k:
		if i >= b // 2:
			e += 1
		elif i <= b // 10:
			h += 1
	if b == 1:
		print('no')
	elif e == 1 and h == 2:
		print('yes')
	else:
		print('no')
	x = x - 1


for t in range(int(input())):
	(n, p) = map(int, input().split(' '))
	l = list(map(int, input().split(' ')))
	enum = 0
	hnum = 0
	easy = p // 2
	hard = p // 10
	for num in l:
		if num >= easy:
			enum += 1
		elif num <= hard:
			hnum += 1
	if hnum == 2 and enum == 1:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(N, P) = map(int, input().split())
	L = list(map(int, input().split()))
	cakewalk = hard = 0
	for i in L:
		if i >= P // 2:
			cakewalk += 1
		elif i <= P // 10:
			hard += 1
	print('yes') if cakewalk == 1 and hard == 2 else print('no')


t = int(input())
for i in range(t):
	(n, p) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	cakewalk = p // 2
	hard = p // 10
	cake1 = list(filter(lambda x: x >= cakewalk, arr))
	hard1 = list(filter(lambda x: 1 <= x <= hard, arr))
	if len(cake1) == 1 and len(hard1) == 2:
		print('yes')
	else:
		print('no')


T = int(input())
for i in range(T):
	(N, P) = list(map(int, input().split()))
	S = list(map(int, input().split()))[:N]
	c = 0
	d = 0
	for j in range(len(S)):
		if S[j] >= P // 2:
			c += 1
		elif S[j] <= P // 10:
			d += 1
	if c == 1 and d == 2:
		print('yes')
	else:
		print('no')


T = int(input())
for _ in range(T):
	(n, p) = map(int, input().split())
	A = list(map(int, input().split()))
	(d, e) = (0, 0)
	for i in A:
		if i <= p // 10:
			d += 1
		elif i >= p // 2:
			e += 1
	if d == 2 and e == 1:
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	(m, n) = map(int, input().split())
	l = list(map(int, input().split()))
	a = int(n / 2)
	b = int(n / 10)
	cnt = 0
	kim = 0
	for i in range(m):
		if l[i] >= a:
			cnt += 1
		elif l[i] <= b:
			kim += 1
	if cnt == 1 and kim == 2:
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	(x, y) = map(int, input().split())
	a = [int(x) for x in input().split()]
	(d, e) = (0, 0)
	for j in a:
		if j <= y // 10:
			d += 1
		elif j >= y // 2:
			e += 1
	if d == 2 and e == 1:
		print('yes')
	else:
		print('no')


T = int(input())
for i in range(T):
	(N, P) = map(int, input().split(' '))
	H = 0
	CW = 0
	arr = list(map(int, input().split(' ')))
	for x in arr:
		if x >= P // 2:
			CW += 1
		elif x <= P // 10:
			H += 1
	if CW == 1 and H == 2:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(n, p) = map(int, input().split())
	(c, h) = (0, 0)
	a = [int(x) for x in input().split()]
	for i in a:
		if i >= p // 2:
			c += 1
		elif i <= p // 10:
			h += 1
	if (c, h) == (1, 2):
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	l = list(map(int, input().split()))
	if len(set(l)) == 1:
		print('no')
	else:
		l1 = []
		for i in l:
			if i >= b // 2:
				l1.append('c')
			elif i <= b // 10:
				l1.append('h')
		if l1.count('c') == 1 and l1.count('h') == 2:
			print('yes')
		else:
			print('no')


t = int(input())
while t != 0:
	(n, p) = map(int, input().split())
	l = list(map(int, input().split()))
	e = h = 0
	for x in l:
		if x >= p // 2:
			e += 1
		elif x <= p // 10:
			h += 1
		if e > 1 or h > 2:
			break
	if e == 1 and h == 2:
		print('yes')
	else:
		print('no')
	t -= 1


t = int(input())
for i in range(t):
	(n, p) = map(int, input().split())
	l = list(map(int, input().split()))
	cw = 0
	hard = 0
	for x in l:
		if x >= p // 2:
			cw += 1
		elif x <= p // 10:
			hard += 1
	if cw == 1 and hard == 2:
		print('yes')
	else:
		print('no')


try:
	for i in range(int(input())):
		(N, P) = map(int, input().split())
		l = list(map(int, input().strip().split()))
		a = b = 0
		for j in l:
			if j >= int(P / 2):
				a += 1
			elif j <= int(P / 10):
				b += 1
		if a == 1 and b == 2:
			print('yes')
		else:
			print('no')
except:
	pass


for _ in range(int(input())):
	(n, p) = map(int, input().split())
	c = list(input().split())
	d = [int(x) for x in c]
	e = 0
	f = 0
	for x in d:
		if x >= p // 2:
			e += 1
		if x <= p // 10:
			f += 1
	if e == 1 and f == 2:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	p2 = p10 = 0
	(n, p) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	for i in a:
		if i >= p // 2:
			p2 += 1
		elif i <= p // 10:
			p10 += 1
	if p2 == 1 and p10 == 2:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(n, p) = map(int, input().split())
	a = list(map(int, input().split()))
	c = 0
	d = 0
	for i in a:
		if i >= int(p / 2):
			c += 1
		elif i <= int(p / 10):
			d += 1
	if c == 1 and d == 2:
		print('yes')
	else:
		print('no')


t = int(input())
for i in range(t):
	lst1 = []
	lst1 = [int(item) for item in input().split()]
	N = lst1[0]
	P = lst1[1]
	a = list(map(int, input().strip().split()))[:N]
	e = 0
	d = 0
	for j in a:
		if j >= int(P / 2):
			e = e + 1
		elif j <= int(P / 10):
			d = d + 1
	if e == 1 and d == 2:
		print('yes')
	else:
		print('no')


t = int(input())
for q in range(t):
	(n, p) = list(map(int, input().split()))
	l = list(map(int, input().split()))
	c = 0
	h = 0
	for i in l:
		if i <= p // 10:
			h = h + 1
		elif i >= p // 2:
			c = c + 1
	if c == 1 and h == 2:
		print('yes')
	else:
		print('no')


from collections import Counter

def dl(string, p):
	q = int(string)
	if q >= p // 2:
		return 'cakewalk'
	elif q <= p // 10:
		return 'hard'
	else:
		return 'neither'
for _ in range(int(input())):
	(n, p) = map(int, input().split())
	a = Counter(map(dl, input().split(), [p] * n))
	print('yes' if a['hard'] == 2 and a['cakewalk'] == 1 else 'no')


for t in range(int(input())):
	(n, p) = [int(x) for x in input().rstrip().split()]
	a = [int(x) for x in input().rstrip().split()]
	cakewalk = 0
	hard = 0
	for i in range(0, n):
		if a[i] >= p // 2 and a[i] <= p:
			cakewalk += 1
		elif a[i] >= 0 and a[i] <= p // 10:
			hard += 1
	if cakewalk == 1 and hard == 2:
		print('yes')
	else:
		print('no')


t = int(input())
for i in range(t):
	(n, p) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	cakewalk = 0
	difficulty = 0
	for i in range(len(a)):
		if a[i] >= p // 2 and a[i] <= p:
			cakewalk = cakewalk + 1
		elif a[i] >= 0 and a[i] <= p // 10:
			difficulty = difficulty + 1
	if cakewalk == 1 and difficulty == 2:
		print('yes')
	else:
		print('no')


t = int(input())
for tc in range(t):
	(n, p) = map(int, input().split())
	a = list(map(int, input().split()))
	h = 0
	c = 0
	for j in a:
		if j <= p // 10:
			h += 1
		elif j >= p // 2:
			c += 1
	if c == 1 and h == 2:
		print('yes')
	else:
		print('no')


def balancedContest(n, p, arr):
	cakewalk = 0
	hard = 0
	for i in range(len(arr)):
		if arr[i] >= int(p / 2):
			cakewalk += 1
		if arr[i] <= int(p / 10):
			hard += 1
	if cakewalk == 1 and hard == 2:
		print('yes')
	else:
		print('no')
	return
t = int(input())
for _ in range(t):
	(n, p) = map(int, input().split())
	arr = list(map(int, input().split()))
	balancedContest(n, p, arr)


for i in range(int(input())):
	(n, p) = map(int, input().split())
	l = list(map(int, input().split()))
	easy = 0
	hard = 0
	ck = p // 2
	hd = p // 10
	for i in l:
		if ck <= i <= p:
			easy += 1
		elif i <= hd:
			hard += 1
	if easy == 1 and hard == 2:
		print('yes')
	else:
		print('no')


def ishard(participants, studentswhosolved):
	if studentswhosolved <= int(participants / 10):
		return True
	else:
		return False

def iscakewalk(participants, studentswhosolved):
	if studentswhosolved >= int(participants / 2):
		return True
	else:
		return False
for t in range(int(input())):
	(n, p) = list(map(int, input().split()))
	cakwalkproblems = 0
	hardproblems = 0
	numberlist = list(map(int, input().split()))
	for _ in range(n):
		if ishard(p, numberlist[_]):
			hardproblems += 1
		elif iscakewalk(p, numberlist[_]):
			cakwalkproblems += 1
	if cakwalkproblems == 1 and hardproblems == 2:
		print('yes')
	else:
		print('no')


t = int(input())
for j in range(1, t + 1):
	(n, p) = map(int, input().split())
	l = list(map(int, input().split()))
	h = p // 10
	c = p // 2
	c1 = 0
	c2 = 0
	for i in l:
		if i >= c:
			c1 = c1 + 1
		elif i <= h:
			c2 = c2 + 1
		else:
			continue
	if c2 == 2 and c1 == 1:
		print('yes')
	else:
		print('no')


t = int(input())
for z in range(t):
	(n, p) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	c = [x for x in a if x >= p // 2]
	h = [x for x in a if x <= p // 10]
	if len(c) == 1 and len(h) == 2:
		print('yes')
	else:
		print('no')


def solve(n, p, arr):
	half = p // 2
	tenth = p // 10
	cake = 0
	hard = 0
	for pr in arr:
		if pr >= half:
			cake += 1
		elif pr <= tenth:
			hard += 1
	if cake == 1 and hard == 2:
		return 'yes'
	return 'no'

def main():
	t = int(input())
	while t:
		t -= 1
		(n, p) = map(int, input().split())
		arr = list(map(int, input().split()))
		print(solve(n, p, arr))
main()


for i in range(int(input())):
	(n, p) = map(int, input().split())
	s = list(map(int, input().split()))[:n]
	count1 = 0
	count2 = 0
	for j in s:
		if j >= p // 2:
			count1 += 1
		if j <= p // 10:
			count2 += 1
	if count1 == 1 and count2 == 2:
		print('yes')
	else:
		print('no')


t = int(input())
for i in range(t):
	(n, p) = map(int, input().split())
	list = [int(i) for i in input().split()]
	temp1 = p // 2
	temp2 = p // 10
	hard = 0
	easy = 0
	for i in list:
		if i <= temp2:
			hard += 1
		elif i >= temp1:
			easy += 1
	if easy == 1 and hard == 2:
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	(m, n) = map(int, input().split())
	lis = list(map(int, input().split()))
	div_2 = n // 2
	div_10 = n // 10
	tuff = 0
	simple = 0
	for i in lis:
		if i <= div_10:
			tuff += 1
		elif i >= div_2:
			simple += 1
	if tuff == 2 and simple == 1:
		print('yes')
	else:
		print('no')


t = int(input())
for ni in range(t):
	(n, p) = map(int, input().split())
	l = [int(i) for i in input().split()]
	cw = 0
	d = 0
	for i in l:
		if i <= int(p / 10):
			d = d + 1
		elif i >= int(p / 2):
			cw = cw + 1
	if cw == 1 and d == 2:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(n, p) = map(int, input().split())
	a = list(map(int, input().split()))
	cw = 0
	hard = 0
	for x in a:
		if x >= p // 2:
			cw += 1
		elif x <= p // 10:
			hard += 1
	if cw == 1 and hard == 2:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	a = list(map(int, input().split()))
	c = 0
	h = 0
	for i in a:
		c += 1 if i >= b // 2 else 0
		h += 1 if i <= b // 10 else 0
	print('yes' if c == 1 and h == 2 else 'no')


T = int(input())
for _ in range(T):
	(n, p) = map(int, input().split())
	cake = p // 2
	c = 0
	hard = p // 10
	h = 0
	solved = list(map(int, input().split()))
	for s in solved:
		if s >= cake:
			c += 1
		elif s <= hard:
			h += 1
	if c == 1 and h == 2:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(N, P) = list(map(int, input().split()))
	S = list(map(int, input().split()))
	(cakewalk, hard) = (0, 0)
	for s in S:
		if s >= P // 2:
			cakewalk += 1
		elif s <= P // 10:
			hard += 1
		if cakewalk > 1 or hard > 2:
			print('no')
			break
	else:
		if cakewalk == 1 and hard == 2:
			print('yes')
		else:
			print('no')


for _ in range(int(input())):
	(n, p) = map(int, input().strip().split())
	if n < 3:
		input()
		print('no')
		continue
	string = list(map(int, input().strip().split()))
	count1 = 0
	count2 = 0
	for i in string:
		if p // 10 >= i:
			count1 += 1
		elif p // 2 <= i:
			count2 += 1
	if count1 == 2 and count2 == 1:
		print('yes')
	else:
		print('no')


t = int(input())
while t:
	(n, p) = map(int, input().split(' '))
	arr = list(map(int, input().split(' ')))[:n]
	(hard, cackwalk) = (0, 0)
	for i in arr:
		if i <= p // 10:
			hard += 1
		elif i >= p // 2:
			cackwalk += 1
		else:
			continue
	if hard == 2 and cackwalk == 1:
		print('yes')
	else:
		print('no')
	t -= 1


t = int(input())
for _ in range(t):
	(n, p) = map(int, input().split())
	integers = list(map(int, input().split()))
	count_hard = 0
	count_cake = 0
	for i in range(n):
		if integers[i] >= p // 2:
			count_cake += 1
		elif integers[i] <= p // 10:
			count_hard += 1
	if count_cake == 1 and count_hard == 2:
		print('yes')
	else:
		print('no')


t = int(input())
for i in range(0, t):
	s = input().split(' ')
	k = int(s[1])
	a = input().split(' ')
	l = list(map(int, a))
	m = k // 10
	n = k // 2
	c = 0
	p = 0
	for i in range(0, len(l)):
		if int(l[i]) >= n:
			c = c + 1
		if int(l[i] <= m):
			p = p + 1
	if p == 2 and c == 1:
		print('yes')
	else:
		print('no')