Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.

Chef wants to order food from a food delivery app. He wishes to order once today, and buy three items costing $A_{1}, A_{2}$ and $A_{3}$ rupees, respectively. He'll also order once tomorrow, when he'll buy three items costing $B_{1}, B_{2}$ and $B_{3}$ rupees, respectively. There is an additional delivery charge of rupees $D$ for each order.

He notices that there is a coupon on sale, which costs rupees $C$. If he buys that coupon, the delivery charges on any day, on an order of rupees $150$ or more shall be waived (that is, the $D$ rupees will not be added, if the sum of the costs of the items is $≥ 150$). 

Note that Chef is ordering the three items together on each day, so the delivery charge is charged only once each day. Also, note that it's only needed to buy the coupon once to avail the delivery fee waiver on both days.

Should Chef buy the coupon? Note that Chef shall buy the coupon only if it costs him strictly less than what it costs him without the coupon, in total.

------ Input: ------

The first line of the input contains a single integer $T$, denoting the number of test cases. 
The first line of each test case contains two space-separated integers $D$ and $C$, denoting the delivery charge, and the price of the coupon, respectively.
The second line of each test case contains three space-separated integers $A_{1}, A_{2}$ and $A_{3}$, denoting the prices of the food items that Chef plans to order on Day $1$, respectively.
The third line of each test case contains three space-separated integers $B_{1}$, $B_{2}$ and $B_{3}$, denoting the prices of the food items that Chef plans to order on Day $2$, respectively.

------ Output: ------
For each test case, output YES if Chef should buy the coupon, and NO otherwise, in a separate line.

------ Constraints  ------
$1 ≤ T ≤ 10^{4}$
$1 ≤ D,C ≤ 100$
$1 ≤  A_{1}, A_{2}, A_{3}  ≤ 100$
$1 ≤ B_{1}, B_{2}, B_{3} ≤ 100$

----- Sample Input 1 ------ 
2
90 100
100 50 10
80 80 80
30 30
100 100 100
10 20 30
----- Sample Output 1 ------ 
YES
NO
----- explanation 1 ------ 
Testcase 1: On the first day, Chef plans on ordering three food items, costing a total of rupees $(100+50+10)=160$.   On the second day, Chef plans on ordering three food items, costing a total of rupees $(80+80+80)=240$.     

If Chef buys the coupon he shall save the delivery charge on both days, but the coupon shall cost him rupees $100$ extra. In total, it shall cost him $(160+240+100)=500$. 

Without the coupon, Chef will have to pay the delivery charges for both days, which shall cost him a total of rupees $(160+240+90+90)=580$. 

Thus, it's better for Chef to buy the coupon.

Testcase 2: On the first day, Chef plans on ordering three food items, costing a total of rupees $(100+100+100)=300$.   On the second day, Chef plans on ordering three food items, costing a total of rupees $(10+20+30)=60$.  

If Chef buys the coupon he shall save the delivery charge on only the first day, but the coupon shall cost him rupees $30$ extra. In total, it shall cost him $(300+60+30$ (coupon cost) $+30$ (delivery cost for second day)$)=420$. 

Without the coupon, Chef will have to pay the delivery charges for both days, which shall cost him a total of rupees $(300+60+30$ (delivery cost for first day)$+30$ (delivery cost for second day)$)=420$. 

Since it shall cost him the same amount in both the cases, Chef shall not buy the coupon.

----- Sample Input 2 ------ 
1
30 45
100 100 100
10 20 30
----- Sample Output 2 ------ 
NO
----- explanation 2 ------ 
Testcase 1: On the first day, Chef plans on ordering three food items, costing a total of rupees $(100+100+100)=300$.   On the second day, Chef plans on ordering three food items, costing a total of rupees $(10+20+30)=60$.  

If Chef buys the coupon he shall save the delivery charge on only the first day, but the coupon shall cost him rupees $45$ extra. In total, it shall cost him $(300+60+45$ (coupon cost) $+30$ (delivery cost for second day)$)=435$. 

Without the coupon, Chef will have to pay the delivery charges for both days, which shall cost him a total of rupees $(300+60+30$ (delivery cost for first day)$+30$ (delivery cost for second day)$)=420$. 

Since it shall cost him strictly more amount when he buys the coupon, Chef shall not buy the coupon.

Difficulty: EASY

Solutions:
for _ in range(int(input())):
	(d, c) = map(int, input().split())
	a_list = list(map(int, input().split()))
	b_list = list(map(int, input().split()))
	e = 0
	if sum(a_list) >= 150:
		e += d
	if sum(b_list) >= 150:
		e += d
	print('YES' if e > c else 'NO')


for _ in range(int(input())):
	(d, c) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	add1 = sum(a)
	add2 = sum(b)
	with_coupon = add1 + add2 + c
	without_coupon = add1 + add2 + d + d
	if add1 < 150:
		with_coupon += d
	if add2 < 150:
		with_coupon += d
	if with_coupon < without_coupon:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	a_list = list(map(int, input().split()))
	b_list = list(map(int, input().split()))
	count = 0
	if sum(a_list) >= 150:
		count += a
	if sum(b_list) >= 150:
		count += a
	print('YES' if count > b else 'NO')


for t in range(int(input())):
	(d, c) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	cost_a = sum(a)
	cost_b = sum(b)
	cost_wd = cost_a + cost_b + 2 * d
	cost_d = 0
	if cost_a >= 150 and cost_b >= 150:
		cost_d = cost_a + cost_b + c
	elif cost_a >= 150 and cost_b < 150 or (cost_a < 150 and cost_b >= 150):
		cost_d = cost_a + cost_b + c + d
	elif cost_a < 150 and cost_b < 150:
		cost_d = cost_a + cost_b + c + 2 * d
	if cost_d < cost_wd:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(d, c) = map(int, input().split())
	d_1 = sum(list(map(int, input().split())))
	d_2 = sum(list(map(int, input().split())))
	total_1 = d_2 + d_1 + c
	if d_1 < 150 and d_2 < 150:
		total_1 += 2 * d
	elif d_1 < 150 or d_2 < 150:
		total_1 += d
	total_2 = d_1 + d_2 + 2 * d
	if total_1 < total_2:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(d, c) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	e = 0
	if sum(a) >= 150:
		e += d
	if sum(b) >= 150:
		e += d
	print('YES' if e > c else 'NO')


for _ in range(int(input())):
	(d, co) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	sa = sum(a)
	sb = sum(b)
	c = 0
	if sa >= 150:
		c += d
	if sb >= 150:
		c += d
	print('YES') if c > co else print('NO')


t = int(input())
for i in range(t):
	(d, c) = map(int, input().split(' '))
	(a1, a2, a3) = map(int, input().split(' '))
	(b1, b2, b3) = map(int, input().split(' '))
	if a1 + a2 + a3 >= 150 or b1 + b2 + b3 >= 150:
		if a1 + a2 + a3 >= 150 and b1 + b2 + b3 >= 150:
			if 2 * d > c:
				print('YES')
			else:
				print('NO')
		elif d > c:
			print('yes')
		else:
			print('NO')
	else:
		print('NO')


for _ in range(int(input())):
	(buddy, janu) = map(int, input().split())
	a1_list = list(map(int, input().split()))
	b1_list = list(map(int, input().split()))
	cute = 0
	if sum(a1_list) >= 150:
		cute += buddy
	if sum(b1_list) >= 150:
		cute += buddy
	print('YES' if cute > janu else 'NO')


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	a = 0
	if sum(l1) >= 150:
		a = a + x
	if sum(l2) >= 150:
		a = a + x
	if a > y:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(d, c) = map(int, input().split())
	(a1, a2, a3) = map(int, input().split())
	(b1, b2, b3) = map(int, input().split())
	su = a1 + a2 + a3 + b1 + b2 + b3 + 2 * d
	suc = su - 2 * d + c
	if a1 + a2 + a3 < 150:
		suc += d
	if b1 + b2 + b3 < 150:
		suc += d
	if su > suc:
		print('YES')
	else:
		print('NO')


testcases = int(input())
while testcases > 0:
	(D, C) = map(int, input().split())
	Day_1 = sum(list(map(int, input().split())))
	Day_2 = sum(list(map(int, input().split())))
	if Day_1 >= 150 and Day_2 >= 150:
		if Day_1 + Day_2 + C == Day_1 + Day_2 + 2 * D:
			print('NO')
		elif Day_1 + Day_2 + C < Day_1 + Day_2 + 2 * D:
			print('YES')
		else:
			print('NO')
	elif Day_1 >= 150 or Day_2 >= 150:
		if Day_1 + Day_2 + C + D == Day_1 + Day_2 + 2 * D:
			print('NO')
		elif Day_1 + Day_2 + C + D < Day_1 + Day_2 + 2 * D:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
	testcases -= 1


t = int(input())
while t:
	(x, y) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	s1 = sum(l1)
	s2 = sum(l2)
	s11 = s1
	s22 = s2
	ts = s1 + x + s2 + x
	if s11 < 150:
		s11 = s11 + x
	if s22 < 150:
		s22 = s22 + x
	ts1 = s11 + s22 + y
	if ts1 < ts:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
while t:
	(x, y) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	s1 = 0
	s2 = 0
	for i in l1:
		s1 = s1 + i
	for j in l2:
		s2 = s2 + j
	s11 = s1
	s22 = s2
	ts = s1 + x + s2 + x
	if s11 < 150:
		s11 = s11 + x
	if s22 < 150:
		s22 = s22 + x
	ts1 = s11 + s22 + y
	if ts1 < ts:
		print('YES')
	else:
		print('NO')
	t -= 1


for i in range(int(input())):
	(d, c) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a = sum(a)
	b = sum(b)
	tnc = a + b
	twc = a + b + c
	if a >= 150:
		tnc += d
	if b >= 150:
		tnc += d
	if twc < tnc:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(d, c) = map(int, input().strip().split())
	a = list(map(int, input().strip().split()))[:3]
	b = list(map(int, input().strip().split()))[:3]
	if 2 * d <= c:
		print('NO')
	elif a[0] + a[1] + a[2] < 150 and b[0] + b[1] + b[2] < 150:
		print('NO')
	elif a[2] + a[0] + a[1] < 150 or b[2] + b[0] + b[1] < 150:
		if c < d:
			print('YES')
		else:
			print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	(d, c) = map(int, input().split())
	(x1, x2, x3) = map(int, input().split())
	(x4, x5, x6) = map(int, input().split())
	m = x1 + x2 + x3 + x4 + x5 + x6
	n = m + 2 * d
	go = m + c
	if x1 + x2 + x3 < 150:
		go += d
	if x4 + x5 + x6 < 150:
		go += d
	if n > go:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(d, c) = map(int, input().split())
	l = list(map(int, input().split()))
	p = list(map(int, input().split()))
	s1 = sum(l)
	s2 = sum(p)
	y = 0
	if s1 < 150:
		y = y + 1
	if s2 < 150:
		y = y + 1
	f1 = s1 + s2 + d * 2
	f2 = s1 + s2 + c + y * d
	if f2 < f1:
		print('YES')
	else:
		print('NO')


def listSum(l):
	sum = 0
	for i in l:
		sum += i
	return sum
for t in range(int(input())):
	(d, c) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	price_without_coupon = listSum(a) + listSum(b) + d + d
	if listSum(a) >= 150:
		if listSum(b) >= 150:
			price_with_coupon = listSum(a) + listSum(b) + c
		else:
			price_with_coupon = listSum(a) + listSum(b) + c + d
	elif listSum(b) >= 150:
		price_with_coupon = listSum(a) + listSum(b) + c + d
	else:
		price_with_coupon = listSum(a) + listSum(b) + c + d + d
	print('YES' if price_with_coupon < price_without_coupon else 'NO')


for _ in range(int(input())):
	(D, C) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	(a, b) = (sum(A), sum(B))
	total = 0
	if a >= 150:
		total += D
	if b >= 150:
		total += D
	if total > C:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(d, c) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	f = 0
	if sum(l1) >= 150:
		f = f + d
	if sum(l2) >= 150:
		f = f + d
	if f > c:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(d, c) = map(int, input().split())
	d1 = list(map(int, input().split()))
	d2 = list(map(int, input().split()))
	a = 0
	b = 0
	s1 = sum(d1)
	s2 = sum(d2)
	if s1 >= 150 and s2 >= 150:
		a = a + s1 + s2 + c
		b = b + s1 + s2 + d + d
		if a < b:
			print('YES')
		else:
			print('NO')
	elif s1 >= 150 or s2 >= 150:
		a = a + s1 + s2 + c + d
		b = b + s1 + s2 + d + d
		if a < b:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
for i in range(n):
	(D, C) = map(int, input().split())
	A = sum(list(map(int, input().split())))
	B = sum(list(map(int, input().split())))
	with_out_coupon = A + B + D + D
	With_Coupon = A + B + C
	if A < 150:
		With_Coupon += D
	if B < 150:
		With_Coupon += D
	if With_Coupon < with_out_coupon:
		print('YES')
	else:
		print('NO')


cases = int(input())
for _ in range(cases):
	(d, c) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	res = 0
	if sum(l1) >= 150:
		res = res + d
	if sum(l2) >= 150:
		res = res + d
	if res > c:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(D, C) = map(int, input().split())
	D1 = sum(list(map(int, input().split())))
	D2 = sum(list(map(int, input().split())))
	Tc_without_coupon = D1 + D2 + D * 2
	Tc_with_coupon = D1 + D2 + C
	if D1 < 150:
		Tc_with_coupon += D
	if D2 < 150:
		Tc_with_coupon += D
	if Tc_with_coupon < Tc_without_coupon:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = list(map(int, input().split()))
	day1 = sum(b)
	day2 = sum(c)
	flag = 0
	if day1 >= 150:
		dtotal1 = day1 + a[0]
		ctotal1 = day1
	else:
		dtotal1 = day1 + a[0]
		ctotal1 = day1 + a[0]
	if day2 >= 150:
		dtotal2 = day2 + a[0]
		ctotal2 = day2
	else:
		dtotal2 = day2 + a[0]
		ctotal2 = day2 + a[0]
	t1 = dtotal1 + dtotal2
	t2 = ctotal1 + ctotal2 + a[1]
	if t1 > t2:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(D, C) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	count = 0
	if sum(A) >= 150:
		count += D
	if sum(B) >= 150:
		count += D
	print('YES' if count > C else 'NO')


for i in range(int(input())):
	(d, c) = map(int, input().split())
	(x, y, z) = map(int, input().split())
	(p, q, r) = map(int, input().split())
	s = x + y + z
	ss = p + q + r
	v = 0
	if s >= 150:
		v += 1
	if ss >= 150:
		v += 1
	if v == 0:
		print('NO')
	elif v == 1:
		if s + ss + c < s + ss + 1 * d:
			print('YES')
		else:
			print('NO')
	elif v == 2:
		if s + ss + c < s + ss + 2 * d:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	(d, c) = map(int, input().split(' '))
	(a1, a2, a3) = map(int, input().split(' '))
	(b1, b2, b3) = map(int, input().split(' '))
	total = a1 + a2 + a3 + (b1 + b2 + b3)
	woc = total + d * 2
	if a1 + a2 + a3 >= 150 and b1 + b2 + b3 >= 150:
		wic = total + c
	elif a1 + a2 + a3 >= 150 or b1 + b2 + b3 >= 150:
		wic = total + c + d
	else:
		wic = woc
	if wic < woc:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	(d, c) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	x = sum(a) + sum(b) + d * 2
	y = 0
	if sum(a) >= 150:
		y += 1
	if sum(b) >= 150:
		y += 1
	if y == 0:
		print('NO')
	elif y == 1:
		if x - d + c < x:
			print('YES')
		else:
			print('NO')
	elif y == 2:
		if x - 2 * d + c < x:
			print('YES')
		else:
			print('NO')


t = int(input())
for i in range(t):
	d_c = input().split(' ')
	price1 = input().split(' ')
	price2 = input().split(' ')
	day1 = int(price1[0]) + int(price1[1]) + int(price1[2])
	day2 = int(price2[0]) + int(price2[1]) + int(price2[2])
	if day1 >= 150 and day2 >= 150 and (int(d_c[1]) < 2 * int(d_c[0])):
		print('YES')
	elif (day1 >= 150 and day2 < 150 or (day2 >= 150 and day1 < 150)) and int(d_c[1]) < int(d_c[0]):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(d, c) = map(int, input().split())
	(a1, a2, a3) = map(int, input().split())
	(b1, b2, b3) = map(int, input().split())
	cost1 = cost2 = 0
	minCost = c
	addn1 = a1 + a2 + a3
	if addn1 >= 150:
		minCost += addn1
	else:
		minCost += addn1 + d
	addn2 = b1 + b2 + b3
	if addn2 >= 150:
		minCost += addn2
	else:
		minCost += addn2 + d
	cost1 = minCost
	cost2 = 2 * d + addn1 + addn2
	if cost1 < cost2:
		print('YES')
	else:
		print('NO')


t = int(input())
for tc in range(t):
	(d, c) = map(int, input().split())
	(a1, a2, a3) = map(int, input().split())
	(b1, b2, b3) = map(int, input().split())
	g = a1 + a2 + a3
	h = b1 + b2 + b3
	n = g + h + 2 * d
	if g >= 150 or h >= 150:
		if g >= 150 and h >= 150:
			m = g + h + c
		elif g >= 150 and h < 150 or (g < 150 and h >= 150):
			m = g + h + c + d
	else:
		m = g + h + 2 * d
	if m >= n:
		print('NO')
	else:
		print('YES')


t = int(input())
while t:
	(d, e) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	x = sum(a)
	y = sum(b)
	p = 0
	if x >= 150:
		p += d
	if y >= 150:
		p += d
	print('YES' if p > e else 'NO')
	t -= 1


for _ in range(int(input())):
	(d, c) = map(int, input().split())
	(x, y, z) = map(int, input().split())
	(m, n, p) = map(int, input().split())
	s1 = x + y + z
	s2 = m + n + p
	if s1 >= 150:
		if s2 >= 150:
			if c < 2 * d:
				print('YES')
			else:
				print('NO')
		elif c + d < 2 * d:
			print('YES')
		else:
			print('NO')
	elif s2 >= 150:
		if c + d < 2 * d:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


for i in range(int(input())):
	(a, b) = map(int, input().split())
	(x1, y1, z1) = map(int, input().split())
	(x2, y2, z2) = map(int, input().split())
	t = x1 + x2 + y1 + y2 + z1 + z2
	d1 = x1 + y1 + z1
	d2 = x2 + y2 + z2
	if d1 >= 150 and d2 >= 150:
		if t + 2 * a > t + b:
			print('YES')
		else:
			print('NO')
	elif d1 < 150 and d2 >= 150 or (d1 >= 150 and d2 < 150):
		if d1 + d2 + a + b < d1 + d2 + 2 * a:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


for i in range(int(input())):
	(d, c) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	ta = sum(a)
	tb = sum(b)
	twd = 0
	twc = ta + tb + d + d
	if ta >= 150 and tb >= 150:
		twd = ta + tb + c
	elif ta >= 150 and tb < 150:
		twd = ta + tb + d + c
	elif ta < 150 and tb >= 150:
		twd = ta + tb + d + c
	else:
		twd = ta + tb + d + d
	if twd < twc:
		print('YES')
	else:
		print('NO')


t = int(input())
for u in range(t):
	(d, c) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	s1 = 0
	s2 = 0
	s = 0
	n = 0
	for i in range(len(a)):
		s1 += a[i]
		s2 += b[i]
	if s1 >= 150 and s2 >= 150:
		s = s1 + s2 + c
		f = s1 + s2 + 2 * d
		if s < f:
			print('YES')
		else:
			print('NO')
	elif s1 >= 150 and s2 < 150:
		s = s1 + s2 + d + c
		f = s1 + s2 + 2 * d
		if s < f:
			print('YES')
		else:
			print('NO')
	elif s1 < 150 and s2 >= 150:
		s = s1 + s2 + d + c
		f = s1 + s2 + 2 * d
		if s < f:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(d, c) = map(int, input().split())
	(a1, a2, a3) = map(int, input().split())
	(b1, b2, b3) = map(int, input().split())
	a = a1 + a2 + a3
	b = b1 + b2 + b3
	e = a + b
	co = e + d + d
	wco = e + c
	if a >= 150 and b >= 150:
		if wco < co:
			print('YES')
		elif wco == co:
			print('NO')
		else:
			print('NO')
	elif a < 150 and b < 150:
		print('NO')
	elif a < 150 or b < 150:
		co = a + b + d + d
		wco = a + b + c + d
		if wco < co:
			print('YES')
		else:
			print('NO')


t = int(input())
while t > 0:
	(d, c) = input().split()
	(d, c) = [int(d), int(c)]
	(a1, a2, a3) = input().split()
	(a1, a2, a3) = [int(a1), int(a2), int(a3)]
	(b1, b2, b3) = input().split()
	(b1, b2, b3) = [int(b1), int(b2), int(b3)]
	cost1 = cost2 = totalcost1 = totalcost2 = 0
	cost1 = a1 + a2 + a3
	cost2 = b1 + b2 + b3
	totalcost2 = totalcost1 = cost1 + cost2 + d + d
	if cost1 >= 150:
		totalcost2 = totalcost2 - d
	if cost2 >= 150:
		totalcost2 = totalcost2 - d
	totalcost2 = totalcost2 + c
	if totalcost2 < totalcost1:
		print('YES')
	else:
		print('NO')
	t = t - 1


tc = int(input())
for _ in range(tc):
	(d, c) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	cost1 = sum(a) + sum(b) + 2 * d
	cost2 = sum(a) + sum(b) + c
	if sum(a) < 150:
		cost2 += d
	if sum(b) < 150:
		cost2 += d
	print('YES' if cost2 < cost1 else 'NO')


for tc in range(int(input())):
	(d, c) = map(int, input().split())
	d1 = list(map(int, input().split()))
	d2 = list(map(int, input().split()))
	e = 0
	if sum(d1) >= 150:
		e += d
	if sum(d2) >= 150:
		e += d
	print('YES' if e > c else 'NO')


t = int(input())
for i in range(t):
	(d, c) = map(int, input().split())
	(r, u) = (1, 1)
	(a1, a2, a3) = map(int, input().split())
	(b1, b2, b3) = map(int, input().split())
	A = a1 + a2 + a3
	B = b1 + b2 + b3
	if A >= 150:
		r = 0
	if B >= 150:
		u = 0
	if A + B + c + r * d + u * d < A + B + 2 * d:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(d, c) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	s1 = sum(a)
	s2 = sum(b)
	w = s1 + s2 + d + d
	if s1 >= 150 and s2 >= 150:
		c = s1 + s2 + c
	elif s1 >= 150 and s2 < 150 or (s1 < 150 and s2 >= 150):
		c = s1 + s2 + d + c
	elif s1 < 150 and s2 < 150:
		c = s1 + s2 + d + d + c
	else:
		pass
	if c < w:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(d, c) = map(int, input().split())
	l = list(map(int, input().split()))
	m = list(map(int, input().split()))
	if sum(l) >= 150 and sum(m) >= 150:
		if sum(l) + 2 * d + sum(m) > sum(l) + sum(m) + c:
			print('YES')
		else:
			print('NO')
	elif sum(l) >= 150 and sum(m) < 150:
		if sum(l) + sum(m) + 2 * d > sum(l) + sum(m) + d + c:
			print('YES')
		else:
			print('NO')
	elif sum(l) < 150 and sum(m) >= 150:
		if sum(l) + sum(m) + 2 * d > sum(l) + sum(m) + d + c:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


q = int(input())
while q > 0:
	(d, c) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	s1 = sum(l1)
	s2 = sum(l2)
	k = 0
	if s1 >= 150:
		k += d
	if s2 >= 150:
		k += d
	if k > c:
		print('YES')
	else:
		print('NO')
	q = q - 1


for tc in range(int(input())):
	(d, c) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	atot = sum(a)
	btot = sum(b)
	withoutc = atot + btot + 2 * d
	if atot >= 150:
		ac = atot
	else:
		ac = atot + d
	if btot >= 150:
		bc = btot
	else:
		bc = btot + d
	withc = ac + bc + c
	if withc < withoutc:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	l = list(map(int, input().split()))
	l1 = list(map(int, input().split()))
	c = 0
	if sum(l) >= 150:
		c += a
	if sum(l1) >= 150:
		c += a
	if c > b:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	(d, c) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	k = 0
	if sum(a) >= 150:
		k += d
	if sum(b) >= 150:
		k += d
	print('YES' if k > c else 'NO')
	t = t - 1


for i in range(int(input())):
	n = 0
	(d, c) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	sum1 = sum(a)
	sum2 = sum(b)
	if sum1 >= 150:
		n += d
	if sum2 >= 150:
		n += d
	if n > c:
		print('YES')
	else:
		print('NO')