Chef is going to start playing Fantasy Football League (FFL) this season. In FFL, each team consists of exactly $15$ players: $2$ goalkeepers, $5$ defenders, $5$ midfielders and $3$ forwards. Chef has already bought $13$ players; he is only missing one defender and one forward.
There are $N$ available players (numbered $1$ through $N$). For each valid $i$, the $i$-th player is either a defender or a forward and has a price $P_i$. The sum of prices of all players in a team must not exceed $100$ dollars and the players Chef bought already cost him $S$ dollars.
Can you help Chef determine if he can complete the team by buying one defender and one forward in such a way that he does not exceed the total price limit?

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first line of each test case contains two space-separated integers $N$ and $S$.
- The second line contains $N$ space-separated integers $P_1, P_2, \ldots, P_N$.
- The last line contains $N$ space-separated integers. For each valid $i$, the $i$-th of these integers is $0$ if the $i$-th player is a defender or $1$ if the $i$-th player is a forward.

-----Output-----
For each test case, print a single line containing the string "yes" if it is possible to build a complete team or "no" otherwise (without quotes).

-----Constraints-----
- $1 \le T \le 100$
- $1 \le N \le 100$
- $13 \le S \le 100$
- $1 \le P_i \le 100$ for each valid $i$

-----Subtasks-----
Subtask #1 (100 points): original constraints

-----Example Input-----
2
4 90
3 8 6 5
0 1 1 0
4 90
5 7 6 5
0 1 1 0

-----Example Output-----
yes
no

-----Explanation-----
Example case 1: If Chef buys the $1$-st and $3$-rd player, the total price of his team is $90 + 9 = 99$, which is perfectly fine. There is no other valid way to pick two players.
Example case 2: Chef cannot buy two players in such a way that all conditions are satisfied.

Difficulty: EASY
Tags: Greedy algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
t = int(input())
for tc in range(t):
	(n, s) = map(int, input().split())
	p = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = 100
	c = 100
	for i in range(n):
		if a[i] == 0:
			if p[i] < b:
				b = p[i]
		elif p[i] < c:
			c = p[i]
	if s + b + c <= 100:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(N, S) = map(int, input().split())
	price = list(map(int, input().split()))
	role = list(map(int, input().split()))
	(a, b) = (100, 100)
	for i in range(N):
		if role[i] == 0:
			if price[i] < a:
				a = price[i]
		elif price[i] < b:
			b = price[i]
	if S + a + b <= 100:
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	(a, b) = map(int, input().split())
	x = list(map(int, input().split()))
	y = list(map(int, input().split()))
	(n, m) = (100, 100)
	for i in range(a):
		if y[i] == 0:
			if x[i] < m:
				m = x[i]
		elif x[i] < n:
			n = x[i]
	print('yes' if b + m + n <= 100 else 'no')


for _ in range(int(input())):
	(n, s) = list(map(int, input().split()))
	p = list(map(int, input().split()))
	l = list(map(int, input().split()))
	mo = 10000000
	mz = 10000000
	for i in range(len(l)):
		if l[i] == 0:
			if p[i] < mz:
				mz = p[i]
		elif p[i] < mo:
			mo = p[i]
	ans = s + mo + mz
	if ans <= 100:
		print('yes')
	else:
		print('no')


t = int(input())
for _ in range(t):
	(n, s) = map(int, input().split())
	p = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	min_def = 9999999
	min_for = 9999999
	for i in range(n):
		if arr[i] == 0:
			if p[i] < min_def:
				min_def = p[i]
		elif p[i] < min_for:
			min_for = p[i]
	if s + min_def + min_for <= 100:
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	(n, s) = map(int, input().split())
	pi = list(map(int, input().split()))
	i = list(map(int, input().split()))
	if len(pi) < 2 or 1 not in i or 0 not in i:
		print('no')
	else:
		one = []
		zero = []
		for j in range(len(i)):
			if i[j] == 1:
				one.append(pi[j])
			else:
				zero.append(pi[j])
		if min(zero) + min(one) <= 100 - s:
			print('yes')
		else:
			print('no')


t = int(input())
for i in range(t):
	(n, p) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	mno = 100
	mnz = 100
	for i in range(n):
		if b[i] == 0:
			if a[i] < mno:
				mno = a[i]
		elif a[i] < mnz:
			mnz = a[i]
	if p + mno + mnz <= 100:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(n, s) = map(int, input().split())
	a1 = list(map(int, input().split()))
	b1 = list(map(int, input().split()))
	ds = []
	f = []
	for i in range(n):
		if b1[i] == 0:
			ds.append(a1[i])
		else:
			f.append(a1[i])
	if len(ds) == 0 or len(f) == 0:
		print('no')
	else:
		do = min(ds)
		fo = min(f)
		a = s + do + fo
		if a <= 100:
			print('yes')
		else:
			print('no')


for _ in range(int(input())):
	(n, l) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = 0
	for i in range(n):
		for j in range(i, n):
			if i != j:
				if b[i] != b[j]:
					if a[i] + a[j] + l <= 100:
						c += 1
	if c >= 1:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(n, s) = map(int, input().split())
	lstp = [int(x) for x in input().split()]
	lstn = [int(x) for x in input().split()]
	(lstd, lstf) = ([], [])
	for (i, j) in enumerate(lstp):
		if lstn[i] == 0:
			lstd.append(j)
		else:
			lstf.append(j)
	if lstd == [] or lstf == []:
		print('no')
	elif min(lstd) + min(lstf) <= 100 - s:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = []
	d = []
	for i in range(n):
		if b[i] == 1:
			c.append(a[i])
		else:
			d.append(a[i])
	r = 100 - m
	if len(c) == 0 or len(d) == 0:
		print('no')
	elif min(c) + min(d) <= r:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(n, s) = map(int, input().split())
	LP = list(map(int, input().split()))
	LC = list(map(int, input().split()))
	defend = []
	forward = []
	for i in range(n):
		if LC[i] == 0:
			defend.append(LP[i])
		else:
			forward.append(LP[i])
	if len(forward) == 0 or len(defend) == 0:
		print('no')
	else:
		defend = sorted(defend)
		forward = sorted(forward)
		if defend[0] + forward[0] + s <= 100:
			print('yes')
		else:
			print('no')


for _ in range(int(input())):
	(n, s) = map(int, input().split())
	p = list(map(int, input().split()))
	q = list(map(int, input().split()))
	n = []
	m = []
	for i in range(len(q)):
		if q[i]:
			n.append(p[i])
		else:
			m.append(p[i])
	if n and m:
		if min(n) + min(m) + s > 100:
			print('no')
		else:
			print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(n, s) = map(int, input().split())
	p = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	m = []
	f = []
	for i in range(n):
		if a[i] == 0:
			m.append(p[i])
		else:
			f.append(p[i])
	if (len(m) != 0 and len(f) != 0) and min(m) + min(f) <= 100 - s:
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	(n, s) = map(int, input().split())
	p = list(map(int, input().split()))
	v = list(map(int, input().split()))
	c = 100 - s
	f = 0
	for j in range(n):
		for k in range(j, n):
			if v[j] == 0 and v[k] == 1 or (v[j] == 1 and v[k] == 0):
				if p[j] + p[k] <= c:
					f = 1
					break
	if f == 1:
		print('yes')
	else:
		print('no')


cases = int(input())
for _ in range(cases):
	(n, s) = map(int, input().split())
	p = list(map(int, input().split()))
	lst = list(map(int, input().split()))
	forward = 100
	defender = 100
	for i in range(0, n):
		if lst[i] == 0:
			if p[i] < defender:
				defender = p[i]
		elif p[i] < forward:
			forward = p[i]
	if s + forward + defender <= 100:
		print('yes')
	else:
		print('no')


for t in range(int(input())):
	(n, s) = map(int, input().split())
	p = list(map(int, input().split()))
	a = list(map(int, input().split()))
	x = []
	y = []
	for i in range(n):
		if a[i] == 0:
			x.append(p[i])
		else:
			y.append(p[i])
	if len(x) == 0 or len(y) == 0:
		print('no')
	elif min(x) + min(y) + s > 100:
		print('no')
	else:
		print('yes')


tc = int(input())
for _ in range(tc):
	(n, s) = map(int, input().split())
	p = list(map(int, input().split()))
	b = list(map(int, input().split()))
	d = [101]
	f = [101]
	for i in range(n):
		if b[i] == 0:
			d.append(p[i])
		else:
			f.append(p[i])
	if min(d) + min(f) + s <= 100:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(n, s) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	d1 = {}
	min_0 = 101
	min_1 = 101
	for i in range(len(l2)):
		if l2[i] == 0 and l1[i] < min_0:
			min_0 = l1[i]
		elif l2[i] == 1 and l1[i] < min_1:
			min_1 = l1[i]
	if s + min_0 + min_1 <= 100:
		print('yes')
	else:
		print('no')


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	l = list(map(int, input().split()))
	m = list(map(int, input().split()))
	(w, x) = (1000000000, 1000000000)
	for j in range(a):
		if m[j] == 0:
			if l[j] < w:
				w = l[j]
		elif l[j] < x:
			x = l[j]
	if w + x + b <= 100:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(k, n) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	d = []
	f = []
	for i in range(k):
		if b[i]:
			d.append(a[i])
		else:
			f.append(a[i])
	if d and f:
		if n + min(d) + min(f) > 100:
			print('no')
		else:
			print('yes')
	else:
		print('no')


t = int(input())
for t in range(t):
	(n, s) = [int(i) for i in input().split()]
	p = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	defe = []
	forw = []
	for i in range(n):
		if a[i] == 1:
			defe.append(p[i])
		else:
			forw.append(p[i])
	rem = 100 - s
	flag = 0
	for k in defe:
		for j in forw:
			sum = k + j
			if sum <= rem:
				flag = 1
				break
	if flag == 1:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(n, s) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	p = []
	q = []
	c = d = 0
	for i in range(n):
		if b[i] == 0:
			c = 1
			p.append(a[i])
		else:
			d = 1
			q.append(a[i])
	if c == 1:
		x = min(p)
	if d == 1:
		y = min(q)
	s = 100 - s
	if c == 0 or d == 0:
		print('no')
	elif x + y <= s:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(n, s) = map(int, input().split())
	p = list(map(int, input().split()))
	d = list(map(int, input().split()))
	fw = 100
	df = 100
	for i in range(0, n):
		if d[i] == 0:
			if p[i] < df:
				df = p[i]
		elif p[i] < fw:
			fw = p[i]
	if s + df + fw <= 100:
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	(n, s) = map(int, input().split())
	p = list(map(int, input().split()))
	c = list(map(int, input().split()))
	(f, d) = ([], [])
	for j in range(n):
		if c[j] == 1:
			f.append(j)
		else:
			d.append(j)
	ans = False
	for j in f:
		if ans:
			break
		for k in d:
			if p[j] + p[k] + s <= 100:
				ans = True
				break
	if ans:
		print('yes')
	else:
		print('no')


t = int(input())
while t != 0:
	(n, m) = map(int, input().split())
	arr = list(map(int, input().split()))
	brr = list(map(int, input().split()))
	maxi = 999
	ma = 999
	for i in range(len(brr)):
		if brr[i] == 1:
			if arr[i] < maxi:
				maxi = arr[i]
		elif brr[i] == 0:
			if arr[i] < ma:
				ma = arr[i]
	if ma + maxi + m <= 100:
		print('yes')
	else:
		print('no')
	t -= 1


for _ in range(int(input())):
	(n, s) = map(int, input().split())
	c = list(map(int, input().split()))
	p = list(map(int, input().split()))
	defender = 100
	forward = 100
	for i in range(n):
		if p[i] == 0:
			if c[i] < defender:
				defender = c[i]
		if p[i] == 1:
			if c[i] < forward:
				forward = c[i]
	if s + defender + forward <= 100:
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	(n, s) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	(a, b) = (100, 100)
	for i in range(n):
		if l2[i] == 0:
			if l1[i] < a:
				a = l1[i]
		elif l1[i] < b:
			b = l1[i]
	if a + b + s <= 100:
		print('yes')
	else:
		print('no')


t = int(input())
for _ in range(t):
	(n, s) = map(int, input().split())
	p = list(map(int, input().split()))
	fl = list(map(int, input().split()))
	(m1, m2) = (float('inf'), float('inf'))
	for (i, j) in zip(fl, p):
		if i == 0:
			m1 = min(m1, j)
		elif i == 1:
			m2 = min(m2, j)
	sm = s + m1 + m2
	if sm <= 100:
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	(n, s) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	m = []
	n = []
	for i in range(len(l1)):
		if l2[i] == 0:
			m.append(l1[i])
		else:
			n.append(l1[i])
	if len(m) > 0 and len(n) > 0:
		if 100 - s >= min(m) + min(n):
			print('yes')
		else:
			print('no')
	else:
		print('no')


t = int(input())
for _ in range(t):
	(n, s) = map(int, input().split())
	p = list(map(int, input().split()))
	a = list(map(int, input().split()))
	budget = 100 - s
	mindef = 100
	minfor = 100
	for i in range(n):
		if a[i] == 0:
			if p[i] <= mindef:
				mindef = p[i]
		if a[i] == 1:
			if p[i] <= minfor:
				minfor = p[i]
	if mindef + minfor <= budget:
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	(n, s) = map(int, input().split())
	list1 = list(map(int, input().split()))
	list2 = list(map(int, input().split()))
	list3 = []
	list4 = []
	j = 0
	while j < n:
		if list2[j] == 1:
			list3.append(list1[j])
		else:
			list4.append(list1[j])
		j += 1
	if len(list3) == 0 or len(list4) == 0:
		print('no')
	elif min(list3) + min(list4) <= 100 - s:
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	(n, s) = map(int, input().split())
	p = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = 101
	d = 101
	for i in range(n):
		if b[i] == 0:
			c = min(c, p[i])
		elif b[i] == 1:
			d = min(d, p[i])
	if c + d + s <= 100:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(n, s) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	min0 = float('inf')
	min1 = float('inf')
	for i in range(n):
		if l2[i] == 0:
			min0 = min(l1[i], min0)
		else:
			min1 = min(l1[i], min1)
	if min1 + min0 <= 100 - s:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(n, s) = map(int, input().split())
	p = list(map(int, input().split()))
	fd = list(map(int, input().split()))
	f = []
	d = []
	if s > 98:
		print('no')
	else:
		for x in range(n):
			if fd[x] == 1:
				f.append(p[x])
			else:
				d.append(p[x])
		y = 0
		for (a, b) in zip(sorted(f), sorted(d)):
			if s + a + b <= 100:
				y = 1
				print('yes')
				break
		if y == 0:
			print('no')


for __ in range(int(input())):
	(a, b) = map(int, input().split())
	l = list(map(int, input().split()))
	lis = list(map(int, input().split()))
	defender = [l[i] for i in range(len(lis)) if lis[i] == 1]
	forward = [l[i] for i in range(len(lis)) if lis[i] == 0]
	if len(forward) == 0 or len(defender) == 0:
		print('no')
	elif b + (min(defender) + min(forward)) <= 100:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(n, s) = list(map(int, input().split()))
	p = list(map(int, input().split()))
	l = list(map(int, input().split()))
	(l1, l2) = ([], [])
	for i in range(len(l)):
		if l[i] == 0:
			l1.append(p[i])
		elif l[i] == 1:
			l2.append(p[i])
	if len(l1) != 0 and len(l2) != 0:
		l1.sort()
		l2.sort()
		s += l1[0] + l2[0]
		if s <= 100:
			print('yes')
		else:
			print('no')
	else:
		print('no')


T = int(input())
while T:
	T -= 1
	(N, S) = list(map(int, input().split(' ')))
	P = list(map(int, input().split(' ')))
	DF = list(map(int, input().split(' ')))
	Dcount = 0
	Fcount = 0
	D = []
	F = []
	for i in range(0, len(DF), 1):
		if DF[i] == 0:
			D.insert(Dcount, P[i])
			Dcount += 1
		else:
			F.insert(Fcount, P[i])
			Fcount += 1
	if D and F:
		if min(D) + min(F) > 100 - S:
			print('no')
		else:
			print('yes')
	else:
		print('no')


t = int(input())
for i in range(1, t + 1):
	arr = list(map(int, input().split()[:2]))
	n = arr[0]
	s = arr[1]
	arr1 = list(map(int, input().split()[:n]))
	arr2 = list(map(int, input().split()[:n]))
	list1 = []
	list2 = []
	for j in range(0, n):
		if arr2[j] == 0:
			list1.append(arr1[j])
		if arr2[j] == 1:
			list2.append(arr1[j])
	min1 = 100
	for j in list1:
		if j < min1:
			min1 = j
	min2 = 100
	for j in list2:
		if j < min2:
			min2 = j
	ans = s + min1 + min2
	if ans > 100:
		print('no')
	else:
		print('yes')


for t in range(int(input())):
	(n, k) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	k = 100 - k
	f = 0
	for i in range(n - 1):
		for j in range(i + 1, n):
			if l2[i] == 0 and l2[j] == 1 or (l2[i] == 1 and l2[j] == 0):
				if l1[i] + l1[j] <= k:
					f = 1
					break
			if f == 1:
				break
		if f == 1:
			break
	if f == 0:
		print('no')
	else:
		print('yes')


import sys

def hasKey(dic, key):
	return key in list(dic.keys())
cases = int(sys.stdin.readline().rstrip())
for case in range(cases):
	[N, S] = list(map(int, sys.stdin.readline().rstrip().split(' ')))
	p = list(map(int, sys.stdin.readline().rstrip().split(' ')))
	t = list(map(int, sys.stdin.readline().rstrip().split(' ')))
	costs = {}
	costs[0] = []
	costs[1] = []
	left = 100 - S
	for i in range(N):
		if t[i] == 0:
			costs[0].append(p[i])
		else:
			costs[1].append(p[i])
	error = True
	for i in costs[0]:
		for j in costs[1]:
			if i + j <= left:
				error = False
				break
		if error == False:
			break
	if error:
		print('no')
	else:
		print('yes')


for _ in range(int(input())):
	(n, s) = map(int, input().split())
	p = list(map(int, input().split()))
	b = list(map(int, input().split()))
	count = 0
	for i in range(n):
		for j in range(i, n):
			if p[i] + p[j] <= 100 - s and b[i] + b[j] == 1:
				count += 1
	if count == 0:
		print('no')
	else:
		print('yes')


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	p = list(map(int, input().split()))
	f = list(map(int, input().split()))
	(e, d) = ([], [])
	for j in range(n):
		if f[j] == 1:
			e.append(j)
		else:
			d.append(j)
	an = False
	for j in e:
		if an:
			break
		for k in d:
			if p[j] + p[k] + m <= 100:
				an = True
				break
	if an:
		print('yes')
	else:
		print('no')


t = int(input())
for i in range(t):
	(n, s) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	m0 = 1000
	m1 = 1000
	for i in range(n):
		if b[i] == 0:
			if m0 > a[i]:
				m0 = a[i]
		elif m1 > a[i]:
			m1 = a[i]
	if s + m0 + m1 > 100:
		print('no')
	else:
		print('yes')


for _ in range(int(input())):
	(n, s) = map(int, input().split())
	p = list(map(int, input().split()))
	t = list(map(int, input().split()))
	d = []
	f = []
	for i in range(n):
		if t[i] == 0:
			d.append(p[i])
		else:
			f.append(p[i])
	if len(d) > 0 and len(f) > 0:
		if min(d) + min(f) <= 100 - s:
			print('yes')
		else:
			print('no')
	else:
		print('no')


def main():
	T = int(input())
	for _ in range(T):
		(N, S) = map(int, input().split())
		Price = list(map(int, input().split()))[:N]
		arr = list(map(int, input().split()))[:N]
		(a, b) = (100, 100)
		for i in range(N):
			if arr[i] == 0:
				if Price[i] < a:
					a = Price[i]
			elif Price[i] < b:
				b = Price[i]
		print('yes' if S + a + b <= 100 else 'no')
main()


t = int(input())
while t != 0:
	(n, s) = map(int, input().split())
	pp = list(map(int, input().split()))
	pord = list(map(int, input().split()))
	minF = 101
	minD = 101
	for i in range(n):
		if pord[i] == 1:
			minF = min(minF, pp[i])
		else:
			minD = min(minD, pp[i])
	if minF + minD + s <= 100:
		print('yes')
	else:
		print('no')
	t -= 1


T = int(input())
for t in range(T):
	(n, s) = input().split()
	num_of_players = int(n)
	cost = int(s)
	price_of_player = list(map(int, input().split()))
	defender_or_forward_player = list(map(int, input().split()))
	count = 0
	for i in range(num_of_players):
		for j in range(i, num_of_players):
			if price_of_player[i] + price_of_player[j] <= 100 - cost and defender_or_forward_player[i] + defender_or_forward_player[j] == 1:
				count = count + 1
	if count == 0:
		print('no')
	else:
		print('yes')


for i in range(int(input())):
	(a, b) = map(int, input().split())
	l = list(map(int, input().split()))
	m = list(map(int, input().split()))
	k = 101
	f = 101
	for i in range(len(m)):
		if m[i] == 0:
			k = min(k, l[i])
		else:
			f = min(f, l[i])
	if k + f + b <= 100:
		print('yes')
	else:
		print('no')


t = int(input())
for i in range(t):
	(n, s) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	d = []
	f = []
	x = 1000
	y = 1000
	for j in range(0, n):
		if b[j] == 0:
			x = min(x, a[j])
		else:
			y = min(y, a[j])
	if x + y + s <= 100:
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	(n, p) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	flag = 0
	for i in range(n):
		if b[i] == 0:
			for j in range(n):
				if b[j] == 1:
					if a[i] + p + a[j] <= 100:
						flag = 1
						break
				if flag == 1:
					break
			if flag == 1:
				break
		if flag == 1:
			break
	if flag == 1:
		print('yes')
	else:
		print('no')


for i in range(int(input())):
	l = [int(i) for i in input().split()]
	(n, s) = l
	c = [int(i) for i in input().split()]
	p = [int(i) for i in input().split()]
	l = [(c[i], p[i]) for i in range(n)]
	l.sort()
	for i in range(n - 1):
		flag = 0
		if s + l[i][0] < 100:
			for j in range(i + 1, n):
				if s + l[i][0] + l[j][0] <= 100 and l[i][1] != l[j][1]:
					print('yes')
					flag = 1
					break
		if flag == 1:
			break
	else:
		print('no')


for _ in range(int(input())):
	(n, s) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	arr2 = list(map(int, input().split()))
	marr = []
	narr = []
	for i in range(len(arr)):
		if arr2[i] == 0:
			marr.append(arr[i])
		else:
			narr.append(arr[i])
	if len(marr) > 0 and len(narr) > 0:
		if 100 - s >= min(marr) + min(narr):
			print('yes')
		else:
			print('no')
	else:
		print('no')


t = int(input())
for i in range(t):
	(n, s) = map(int, input().split())
	price = list(map(int, input().split()))
	players = list(map(int, input().split()))
	s1 = 100
	s2 = 100
	for i in range(n):
		if price[i] < s1 and players[i] == 1:
			s1 = price[i]
		elif price[i] < s2 and players[i] == 0:
			s2 = price[i]
	if s1 + s2 + s <= 100:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(n, s) = map(int, input().split())
	p = list(map(int, input().split()))
	a = list(map(int, input().split()))
	if a.count(0) > 0 and a.count(1) > 0:
		m = {}
		for (k, v) in enumerate(a):
			if v not in m:
				m[v] = p[k]
			else:
				m[v] = min(m[v], p[k])
		if m[0] + m[1] <= 100 - s:
			print('yes')
		else:
			print('no')
	else:
		print('no')


t = int(input())
while t > 0:
	t -= 1
	(n, s) = list(map(int, input().split()))
	p = list(map(int, input().split()))
	a = list(map(int, input().split()))
	mind = 101
	minf = 101
	for j in range(n):
		if a[j] == 0:
			if p[j] < mind:
				mind = p[j]
		elif p[j] < minf:
			minf = p[j]
	if mind + minf + s > 100:
		print('no')
	else:
		print('yes')


t = int(input())
for t in range(t):
	(n, s) = [int(i) for i in input().split()]
	p = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	if len(p) < 2 or 1 not in a or 0 not in a:
		print('no')
	else:
		defe = []
		forw = []
		for i in range(n):
			if a[i] == 1:
				defe.append(p[i])
			else:
				forw.append(p[i])
		rem = 100 - s
		if min(defe) + min(forw) <= rem:
			print('yes')
		else:
			print('no')


def main():
	T = int(input())
	for _ in range(T):
		(N, S) = map(int, input().split())
		Price = list(map(int, input().split()))[:N]
		arr = list(map(int, input().split()))[:N]
		flag = False
		ans = True
		for i in range(N):
			if arr[i] == 1:
				for j in range(i + 1, N):
					if arr[j] == 0 and S + Price[i] + Price[j] <= 100:
						print('yes')
						flag = True
						break
			elif arr[i] == 0:
				for j in range(i + 1, N):
					if arr[j] == 1 and S + Price[i] + Price[j] <= 100:
						print('yes')
						flag = True
						break
			if flag:
				ans = False
				break
		if ans:
			print('no')
main()


for tc in range(int(input())):
	(n, s) = map(int, input().split())
	arr = list(map(int, input().split()))
	ty = list(map(int, input().split()))
	mind = 100
	minf = 100
	for i in range(n):
		if ty[i]:
			mind = min(mind, arr[i])
		else:
			minf = min(minf, arr[i])
	req = 100 - s
	if req >= mind + minf:
		print('yes')
	else:
		print('no')


t = int(input())
for _ in range(t):
	(n, s) = map(int, input().split())
	c = list(map(int, input().split()))
	a = list(map(int, input().split()))
	x = y = 101
	for i in range(n):
		if a[i] == 0:
			x = min(x, c[i])
			if s + x + y <= 100:
				print('yes')
				break
		else:
			y = min(y, c[i])
			if s + x + y <= 100:
				print('yes')
				break
	else:
		print('no')


for _ in range(int(input())):
	(n, s) = map(int, input().split())
	arr_price = list(map(int, input().split()))
	arr_players = list(map(int, input().split()))
	a = b = 101
	for i in range(n):
		if arr_players[i] == 0:
			a = min(a, arr_price[i])
			if s + a + b <= 100:
				print('yes')
				break
		else:
			b = min(b, arr_price[i])
			if s + a + b <= 100:
				print('yes')
				break
	else:
		print('no')


for _ in range(int(input())):
	(N, S) = map(int, input().split())
	price = list(map(int, input().split()))
	player = list(map(int, input().split()))
	d = 100
	f = 100
	for i in range(N):
		if player[i] == 0:
			if price[i] < d:
				d = price[i]
		elif price[i] < f:
			f = price[i]
	if S + d + f <= 100:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(n, s) = map(int, input().split())
	df = list(map(int, input().split()))
	index = list(map(int, input().split()))
	(d, f) = ([], [])
	for i in range(n):
		if index[i] == 0:
			d.append(df[i])
		else:
			f.append(df[i])
	rem = 100 - s
	flag = False
	for i in d:
		for j in f:
			p = i + j
			if p <= rem:
				flag = True
				break
	print('yes' if flag else 'no')


t = int(input())
for _ in range(t):
	(n, s) = map(int, input().split())
	p = list(map(int, input().split()))
	k = list(map(int, input().split()))
	f = 100
	d = 100
	for i in range(n):
		if k[i] == 0:
			if p[i] < d:
				d = p[i]
		elif p[i] < f:
			f = p[i]
	maxi = s + d + f
	if maxi <= 100:
		print('yes')
	else:
		print('no')


for tc in range(int(input())):
	(n, s) = map(int, input().split())
	p = list(map(int, input().split()))
	l = list(map(int, input().split()))
	if l.count(0) == 0 or l.count(1) == 0:
		print('no')
	else:
		z = 100 - s
		x = min([p[i] for i in range(n) if l[i] == 0])
		y = min([p[i] for i in range(n) if l[i] == 1])
		if z < x + y:
			print('no')
		else:
			print('yes')


for _ in range(int(input())):
	(n, s) = tuple(map(int, input().split()))
	p = list(map(int, input().split()))
	isattacker = list(map(int, input().split()))
	minatk = 101
	mindef = 101
	for (pos, price) in zip(isattacker, p):
		if pos == 1 and minatk > price:
			minatk = price
		elif pos == 0 and mindef > price:
			mindef = price
	if s + minatk + mindef <= 100:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	k = 100 - k
	a = list(map(int, input().strip().split()))
	b = list(map(int, input().strip().split()))
	d_min = 100
	a_min = 100
	for i in range(n):
		if b[i] == 0 and a[i] < d_min:
			d_min = a[i]
		elif b[i] == 1 and a[i] < a_min:
			a_min = a[i]
	if a_min + d_min <= k:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(n, s) = map(int, input().split())
	p = list(map(int, input().split()))
	l = list(map(int, input().split()))
	if l.count(0) == 0 or l.count(1) == 0:
		ans = 'no'
	else:
		dfd_price = min((p[i] for i in range(n) if l[i] == 0))
		fwd_price = min((p[i] for i in range(n) if l[i] == 1))
		ans = 'yes' if dfd_price + fwd_price + s <= 100 else 'no'
	print(ans)


for _ in range(int(input())):
	(n, s) = map(int, input().split())
	P = list(map(int, input().split()))
	df = list(map(int, input().split()))
	(d, f) = (100, 100)
	for i in range(n):
		if df[i] == 0:
			if P[i] < d:
				d = P[i]
		elif P[i] < f:
			f = P[i]
	if s + d + f <= 100:
		print('yes')
	else:
		print('no')


for _ in range(int(input())):
	(N, S) = map(int, input().split())
	P = list(map(int, input().split()))
	X = list(map(int, input().split()))
	d = max(P)
	f = max(P)
	i = 0
	while i < len(X):
		if X[i] == 0:
			if P[i] < d:
				d = P[i]
		if X[i] == 1:
			if P[i] < f:
				f = P[i]
		i += 1
	if 1 in X and 0 in X:
		if 100 - S >= f + d:
			print('yes')
		else:
			print('no')
	else:
		print('no')


testcases = int(input())
while testcases > 0:
	(N, S) = map(int, input().split())
	Pl_ = list(map(int, input().split()))
	DEs_ = list(map(int, input().split()))
	D = 100
	F = 100
	for i in range(N):
		if DEs_[i] == 0:
			if Pl_[i] < D:
				D = Pl_[i]
		elif Pl_[i] < F:
			F = Pl_[i]
	if D + F + S <= 100:
		print('yes')
	else:
		print('no')
	testcases -= 1


t = int(input())
while t > 0:
	(n, c) = map(int, input().split())
	arr = list(map(int, input().split()))
	brr = list(map(int, input().split()))
	d = []
	f = []
	m1 = 9999
	m2 = 9999
	for i in range(len(arr)):
		if brr[i] == 1:
			if arr[i] < m1:
				m1 = arr[i]
		elif arr[i] < m2:
			m2 = arr[i]
	if m1 + m2 + c <= 100:
		print('yes')
	else:
		print('no')
	t = t - 1


for _ in range(int(input())):
	(n, s) = map(int, input().split())
	p = list(map(int, input().split()))
	k = list(map(int, input().split()))
	t = 1000
	l = 1000
	for i in range(n):
		if k[i] == 0:
			t = min(t, p[i])
		else:
			l = min(l, p[i])
	if t + l + s <= 100:
		print('yes')
	else:
		print('no')


t = int(input())
for i in range(t):
	(n, s) = map(int, input().split())
	c = list(map(int, input().split()))
	p = list(map(int, input().split()))
	d = 100
	f = 100
	for i in range(n):
		if p[i] == 0:
			d = min(d, c[i])
		else:
			f = min(f, c[i])
	print('yes' if s + d + f <= 100 else 'no')


t = int(input())
for _ in range(t):
	(n, s) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	t = 1090
	p = 10999
	for i in range(len(b)):
		if b[i] == 0:
			t = min(t, a[i])
		else:
			p = min(p, a[i])
	if s + t + p <= 100:
		print('yes')
	else:
		print('no')


t = int(input())
for i in range(t):
	(n, s) = [int(x) for x in input().split()]
	lst1 = [int(x) for x in input().split()]
	lst2 = [int(x) for x in input().split()]
	min1 = 100
	min2 = 100
	for j in range(n):
		if lst2[j] == 0:
			if min1 > lst1[j]:
				min1 = lst1[j]
		elif min2 > lst1[j]:
			min2 = lst1[j]
	if min1 + min2 + s <= 100:
		print('yes')
	else:
		print('no')


t = int(input())
for i in range(t):
	(n, s) = map(int, input().split())
	p = list(map(int, input().split()))
	type = input().replace(' ', '')
	(t1, t2) = (100, 100)
	for i in range(n):
		if type[i] == '0':
			if p[i] < t1:
				t1 = p[i]
		elif p[i] < t2:
			t2 = p[i]
	if s + t1 + t2 <= 100:
		print('yes')
	else:
		print('no')


t = int(input())
while t > 0:
	(n, s) = map(int, input().split())
	p = list(map(int, input().split()))
	a = list(map(int, input().split()))
	l = []
	m = []
	for i in range(n):
		if a[i] == 0:
			l.append(p[i])
		else:
			m.append(p[i])
	if len(l) == 0 or len(m) == 0:
		print('no')
	else:
		x = min(l)
		y = min(m)
		z = s + x + y
		if z <= 100:
			print('yes')
		else:
			print('no')
	t = t - 1


t = int(input())
while t > 0:
	(n, s) = map(int, input().split())
	a = list(map(int, input().split()))
	c = {0: 101, 1: 101}
	b = list(map(int, input().split()))
	if n == 1:
		print('no')
	else:
		for (e1, e2) in zip(a, b):
			if c.get(e2) > e1:
				c[e2] = e1
		if c[0] + c[1] <= 100 - s:
			print('yes')
		else:
			print('no')
	t -= 1


for T in range(int(input())):
	(n, s) = list(map(int, input().split()))
	p = list(map(int, input().split()))
	ls = list(map(int, input().split()))
	d = []
	f = []
	flag1 = 0
	for i in range(n):
		if ls[i] == 0:
			d.append(p[i])
		else:
			f.append(p[i])
	for j in range(len(d)):
		for k in range(len(f)):
			if 100 - s >= d[j] + f[k]:
				flag1 = 1
				break
	if flag1 == 1:
		print('yes')
	else:
		print('no')