The great hero guards the country where Homer lives. The hero has attack power $A$ and initial health value $B$. There are $n$ monsters in front of the hero. The $i$-th monster has attack power $a_i$ and initial health value $b_i$.

The hero or a monster is said to be living, if his or its health value is positive (greater than or equal to $1$); and he or it is said to be dead, if his or its health value is non-positive (less than or equal to $0$).

In order to protect people in the country, the hero will fight with monsters until either the hero is dead or all the monsters are dead.

In each fight, the hero can select an arbitrary living monster and fight with it. Suppose the $i$-th monster is selected, and the health values of the hero and the $i$-th monster are $x$ and $y$ before the fight, respectively. After the fight, the health values of the hero and the $i$-th monster become $x-a_i$ and $y-A$, respectively.

Note that the hero can fight the same monster more than once.

For the safety of the people in the country, please tell them whether the great hero can kill all the monsters (even if the great hero himself is dead after killing the last monster).


-----Input-----

Each test contains multiple test cases. The first line contains $t$ ($1 \le t \le 10^5$) — the number of test cases. Description of the test cases follows.

The first line of each test case contains three integers $A$ ($1 \leq A \leq 10^6$), $B$ ($1 \leq B \leq 10^6$) and $n$ ($1 \leq n \leq 10^5$) — the attack power of the great hero, the initial health value of the great hero, and the number of monsters.

The second line of each test case contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \leq a_i \leq 10^6$), where $a_i$ denotes the attack power of the $i$-th monster.

The third line of each test case contains $n$ integers $b_1, b_2, \dots, b_n$ ($1 \leq b_i \leq 10^6$), where $b_i$ denotes the initial health value of the $i$-th monster.

It is guaranteed that the sum of $n$ over all test cases does not exceed $10^5$.


-----Output-----

For each test case print the answer: "YES" (without quotes) if the great hero can kill all the monsters. Otherwise, print "NO" (without quotes).


-----Examples-----

Input
5
3 17 1
2
16
10 999 3
10 20 30
100 50 30
1000 1000 4
200 300 400 500
1000 1000 1000 1000
999 999 1
1000
1000
999 999 1
1000000
999
Output
YES
YES
YES
NO
YES


-----Note-----

In the first example: There will be $6$ fights between the hero and the only monster. After that, the monster is dead and the health value of the hero becomes $17 - 6 \times 2 = 5 > 0$. So the answer is "YES", and moreover, the hero is still living.

In the second example: After all monsters are dead, the health value of the hero will become $709$, regardless of the order of all fights. So the answer is "YES".

In the third example: A possible order is to fight with the $1$-st, $2$-nd, $3$-rd and $4$-th monsters. After all fights, the health value of the hero becomes $-400$. Unfortunately, the hero is dead, but all monsters are also dead. So the answer is "YES".

In the fourth example: The hero becomes dead but the monster is still living with health value $1000 - 999 = 1$. So the answer is "NO".

Difficulty: EASY
Tags: Sorting

Implementation

Greedy algorithms
Skill types: Sorting

Greedy algorithms

Starter code:

Solutions:
import sys
input = sys.stdin.readline
from math import *
a = int(input())
for x in range(a):
	(a, b, c) = map(int, input().split())
	d = list(map(int, input().split()))
	e = list(map(int, input().split()))
	j = []
	for y in range(c):
		j.append([d[y], e[y]])
	j.sort()
	for y in range(c):
		p = ceil(j[y][1] / a)
		b -= p * j[y][0]
	if b + j[-1][0] > 0:
		print('YES')
	else:
		print('NO')


import math
import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	monster_power = list(map(int, input().split()))
	monster_health = list(map(int, input().split()))
	monster = []
	for i in range(n):
		monster.append([monster_power[i], monster_health[i]])
	monster.sort()
	for i in range(n - 1):
		b = b - math.ceil(monster[i][1] / a) * monster[i][0]
	if b < 0:
		print('NO')
		continue
	monster[-1][1] = monster[-1][1] - math.ceil(b / monster[-1][0]) * a
	b = b - math.ceil(b / monster[-1][0]) * monster[-1][0]
	if monster[-1][1] <= 0:
		print('YES')
	else:
		print('NO')


import math as mt
for _ in range(int(input())):
	(A, B, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	for i in range(n):
		b[i] = mt.ceil(b[i] / A)
	s = 0
	ratio = []
	for i in range(n):
		ratio.append([a[i], b[i]])
	ratio = sorted(ratio, key=lambda x: x[0])
	flag = True
	for i in range(n):
		if B - ratio[i][0] * (ratio[i][1] - 1) > 0:
			B -= ratio[i][0] * ratio[i][1]
		else:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


from math import ceil

def main():
	t = int(input())
	for _ in range(t):
		(A, B, n) = map(int, input().split())
		a = [int(x) for x in input().split()]
		b = [int(x) for x in input().split()]
		max_a = max(a)
		truth = True
		for i in range(n):
			fights = ceil(b[i] / A)
			B -= fights * a[i]
			if B <= -max_a:
				print('NO')
				truth = False
				break
		if truth:
			print('YES')
main()


def doit():
	(A, B, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	for i in range(n):
		B -= ((b[i] - 1) // A + 1) * a[i]
	B += max(a)
	print('YES' if B > 0 else 'NO')
T = int(input())
for _ in range(T):
	doit()


t = int(input())
for _ in range(t):
	(A, B, n) = map(int, input().split())
	arr = list(map(int, input().split()))
	brr = list(map(int, input().split()))
	damage = 0
	for i in range(n):
		damage += int(brr[i] + A - 1) // A * arr[i]
	flag = False
	for i in range(n):
		if B - damage + arr[i] > 0:
			print('YES')
			flag = True
			break
	if flag == False:
		print('NO')


import sys
import heapq as hq
for _ in range(int(sys.stdin.readline())):
	(hero_attack, hero_health, monster_num) = map(int, sys.stdin.readline().split())
	monster_attack = list(map(int, sys.stdin.readline().split()))
	monster_health = list(map(int, sys.stdin.readline().split()))
	pq = []
	for i in range(monster_num):
		hq.heappush(pq, [monster_attack[i], monster_health[i]])
	hero_win = True
	while pq:
		(ma, mh) = hq.heappop(pq)
		if hero_health % ma == 0 and mh % hero_attack == 0:
			moster_attack_time = hero_health // ma
			hero_attack_time = mh // hero_attack
		elif hero_health % ma == 0 and mh % hero_attack != 0:
			moster_attack_time = hero_health // ma
			hero_attack_time = mh // hero_attack + 1
		elif hero_health % ma != 0 and mh % hero_attack == 0:
			moster_attack_time = hero_health // ma + 1
			hero_attack_time = mh // hero_attack
		else:
			moster_attack_time = hero_health // ma + 1
			hero_attack_time = mh // hero_attack + 1
		attack_time = min(moster_attack_time, hero_attack_time)
		hero_health -= attack_time * ma
		if hero_health <= 0:
			if pq or mh - attack_time * hero_attack > 0:
				hero_win = False
				break
	if hero_win:
		print('YES')
	else:
		print('NO')


erwq = int(input())
for qwerqw in range(erwq):
	(A, B, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	d = [0] * n
	for i in range(n):
		d[i] = a[i] * ((A + b[i] - 1) // A)
	s = sum(d)
	for i in range(n):
		if B - s + a[i] >= 1:
			print('YES')
			break
	else:
		print('NO')


import sys
for _ in range(int(sys.stdin.readline())):
	(A, B, n) = map(int, sys.stdin.readline().split())
	a = [int(i) for i in sys.stdin.readline().split()]
	b = [int(i) for i in sys.stdin.readline().split()]
	total_damage = 0
	for ind in range(n):
		num_of_battles = b[ind] // A
		num_of_battles += 1 if b[ind] % A != 0 else 0
		total_damage += a[ind] * num_of_battles
	total_damage -= max(a)
	if B - total_damage > 0:
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
from collections import defaultdict as dd
from math import sqrt

def main():
	from math import ceil
	for _ in range(int(input())):
		(a, b, n) = map(int, input().split())
		ma = list(map(int, input().split()))
		mb = list(map(int, input().split()))
		m = list(zip(ma, mb))
		m.sort()
		die = 0
		for (i, j) in m:
			nm = ceil(j / a)
			nh = ceil(b / i)
			if nm > nh:
				die = 1
				break
			b -= nm * i
		if die:
			print('NO')
		else:
			print('YES')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from math import ceil
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	p = list(map(int, input().split()))
	h = list(map(int, input().split()))
	s = 0
	for i in range(n):
		c = ceil(h[i] / a) * p[i]
		s += c
	if b - s + max(p) > 0:
		print('YES')
	else:
		print('NO')


def solve():
	(A, B, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	dame = 0
	for i in range(n):
		dame += (b[i] + A - 1) // A * a[i]
	for i in range(n):
		if B - (dame - a[i]) > 0:
			print('YES')
			return
	print('NO')
	return
t = int(input())
for i in range(t):
	solve()


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	ea = list(map(int, input().split()))
	eh = list(map(int, input().split()))
	for (x, y) in sorted(zip(ea, eh)):
		b = b + -y // a * x
	if b <= -x:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	for (x, y) in sorted(zip(map(int, input().split()), map(int, input().split()))):
		if b > 0:
			d = (y + a - 1) // a
			if x * (d - 1) >= b:
				break
			b -= x * d
			n -= 1
		else:
			break
	print('YES' if n <= 0 else 'NO')


from math import *
from sys import *
input = stdin.readline
for _ in range(int(input())):
	(A, B, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	cost = []
	for i in range(n):
		cnt = ceil(b[i] / A)
		cost.append(a[i] * cnt)
	ex = B - sum(cost)
	if max(a) >= -ex:
		print('YES')
	else:
		print('NO')


def main():
	for _ in range(int(input())):
		(A, B, n) = map(int, input().split())
		aa = list(map(int, input().split()))
		bb = list(map(int, input().split()))
		i = max(range(n), key=aa.__getitem__)
		(aa[i], aa[n - 1], bb[i], bb[n - 1]) = (aa[n - 1], aa[i], bb[n - 1], bb[i])
		for (a, b) in zip(aa, bb):
			B -= (b - 1) // A * a
			if B < 1:
				print('NO')
				break
			B -= a
		else:
			print('YES')
main()


for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	l = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	h = 0
	c = 0
	for i in range(n):
		h += (l2[i] + a - 1) // a * l[i]
	for i in range(n):
		if b - (h - l[i]) > 0:
			c = 1
	if c == 1:
		print('YES')
	else:
		print('NO')


from math import ceil
from functools import cmp_to_key

class Monster:

	def __init__(self, pr, hp):
		self.pr = pr
		self.hp = hp

	def __str__(self):
		return 'power:{} hp:{}'.format(self.pr, self.hp)

def cmp(m1, m2):
	if m1.pr < m2.pr:
		return -1
	elif m1.pr == m2.pr:
		return 0
	else:
		return 1
t = int(input())
for k in range(t):
	(pr, hp, n) = (int(x) for x in input().split(' '))
	mp = []
	mh = []
	mp.extend((int(x) for x in input().split(' ')))
	mh.extend((int(x) for x in input().split(' ')))
	monster = []
	for i in range(n):
		monster.append(Monster(mp[i], mh[i]))
	monster.sort(key=cmp_to_key(cmp))
	alive = True
	for i in range(n):
		if i < n - 1:
			attack = ceil(monster[i].hp / pr)
			hp -= attack * monster[i].pr
			monster[i].hp -= pr * attack
			if hp <= 0:
				alive = False
		elif not hp > monster[i].pr * (ceil(monster[i].hp / pr) - 1):
			alive = False
	print('YES' if alive else 'NO')


t = int(input())
while t:
	(A, H, n) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	h = list(map(int, input().split()))
	damage = 0
	for i in range(n):
		damage = damage + (h[i] + A - 1) // A * a[i]
	flag = False
	for i in range(n):
		if H - (damage - a[i]) > 0:
			flag = True
			break
	if flag:
		print('YES')
	else:
		print('NO')
	t = t - 1


for tt in range(int(input())):
	(A, B, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	d = 0
	for i in range(n):
		d += (b[i] + A - 1) // A * a[i]
	for i in range(n):
		if B - d + a[i] > 0:
			print('YES')
			break
	else:
		print('NO')


import math
import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		(A, B, n) = map(int, input().split())
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
		c = list(zip(a, b))
		c = sorted(c, key=lambda x: x[0], reverse=False)
		ans = True
		for i in range(n):
			p = math.ceil(c[i][1] / A)
			B -= c[i][0] * p
			if B <= 0:
				if i == n - 1 and abs(B) < c[i][0]:
					break
				else:
					ans = False
					break
		if ans:
			print('YES')
		else:
			print('NO')
main()


import sys
t = int(input())

def count(bi, A):
	if bi % A == 0:
		return bi // A
	else:
		return bi // A + 1
for _ in range(t):
	(A, B, n) = map(int, sys.stdin.readline().strip().split())
	a = list(map(int, sys.stdin.readline().strip().split()))
	b = list(map(int, sys.stdin.readline().strip().split()))
	damage = []
	for i in range(n):
		d = a[i] * count(b[i], A)
		damage.append(d)
	if B - sum(damage) > -max(a):
		print('YES')
	else:
		print('NO')


import sys
import math

def fn(A, B, n, a, b):
	asum = sum(a)
	bsum = sum(b)
	z = [0] * n
	for i in range(n):
		z[i] = [a[i], b[i]]
	z.sort(key=lambda x: x[0])
	if A >= max(b) and B >= asum:
		print('YES')
		return 0
	c = 0
	for i in range(n):
		k = math.ceil(z[i][1] / A)
		j = math.ceil(B / z[i][0])
		if k <= j:
			c = c + 1
			B = B - k * z[i][0]
		else:
			print('NO')
			return 0
	if c == n:
		print('YES')
		return 0
input = sys.stdin.read()
data = list(map(int, input.split()))
t = data[0]
l = 0
for i in range(t):
	A = data[l + 1]
	B = data[l + 2]
	n = data[l + 3]
	a = data[l + 4:l + 4 + n]
	b = data[l + 4 + n:l + 4 + 2 * n]
	l = l + 3 + 2 * n
	fn(A, B, n, a, b)


import sys
import math
import bisect
fast_reader = sys.stdin.readline
fast_writer = sys.stdout.write

def input():
	return fast_reader().strip()

def print(*argv):
	fast_writer(' '.join((str(i) for i in argv)))
	fast_writer('\n')
for T in range(int(input())):
	(A, H, n) = map(int, input().split())
	a = list(map(int, input().split()))
	h = list(map(int, input().split()))
	h = [x for (_, x) in sorted(zip(a, h))]
	a.sort()
	pos = True
	for i in range(n):
		m = math.ceil(h[i] / A)
		if H - a[i] * (m - 1) <= 0:
			pos = False
			break
		H -= a[i] * m
		h[i] -= A * m
	if pos and h[-1] <= 0:
		print('YES')
	else:
		print('NO')


a = int(input())
fin = []
for i in range(a):
	(a, b, c) = map(int, input().split())
	dam = list(map(int, input().split()))
	hel = list(map(int, input().split()))
	if sum(dam) < b and sum(hel) < a:
		fin.append('YES')
	else:
		mas = [0] * len(dam)
		for i in range(len(dam)):
			mas[i] = [0] * 2
		for i in range(len(dam)):
			mas[i][0] = dam[i]
			mas[i][1] = hel[i]
		mas.sort()
		for i in range(len(dam)):
			z = mas[i][1] // a
			if mas[i][1] % a != 0:
				z += 1
			b -= z * mas[i][0]
			if b <= 0:
				if i == len(dam) - 1 and abs(b) < mas[i][0]:
					fin.append('YES')
					break
				else:
					fin.append('NO')
					break
			if i == len(dam) - 1:
				fin.append('YES')
for i in range(len(fin)):
	print(fin[i])


from math import ceil
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	l = list(map(int, input().split()))
	m = list(map(int, input().split()))
	big = max(l)
	for i in range(n):
		l[i] = l[i] * ceil(m[i] / a)
	small = sum(l) - big
	if b - small >= 1:
		print('YES')
	else:
		print('NO')


import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
input = lambda : sys.stdin.readline().rstrip()
import bisect, string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby
rep = range
R = range

def I():
	return int(input())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def NLI(n):
	return [[int(i) for i in input().split()] for i in range(n)]

def NLI_(n):
	return [[int(i) - 1 for i in input().split()] for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def RLI(n=8, a=1, b=10):
	return [random.randint(a, b) for i in range(n)]

def RI(a=1, b=10):
	return random.randint(a, b)

def INP():
	N = 9
	n = random.randint(1, N)
	A = [random.randint(1, n) for i in range(m)]
	return (n, A)

def Rtest(T):
	(case, err) = (0, 0)
	for i in range(T):
		inp = INP()
		a1 = naive(*inp)
		a2 = solve(*inp)
		if a1 != a2:
			print(inp)
			print('naive', a1)
			print('solve', a2)
			err += 1
		case += 1
	print('Tested', case, 'case with', err, 'errors')

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in range(V)]
	FromStdin = True if ls == None else False
	for i in range(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in R(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def accum(ls):
	rt = [0]
	for i in ls:
		rt += [rt[-1] + i]
	return rt

def bit_combination(n, base=2):
	rt = []
	for tb in R(base ** n):
		s = [tb // base ** bt % base for bt in R(n)]
		rt += [s]
	return rt

def gcd(x, y):
	if y == 0:
		return x
	if x % y == 0:
		return y
	while x % y != 0:
		(x, y) = (y, x % y)
	return y

def YN(x):
	print(['NO', 'YES'][x])

def Yn(x):
	print(['No', 'Yes'][x])

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
mo = 10 ** 9 + 7
inf = 1 << 63
FourNb = [(-1, 0), (1, 0), (0, 1), (0, -1)]
EightNb = [(-1, 0), (1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('WENS', FourNb))
cursol = dict(zip('LRUD', FourNb))
alp = [chr(ord('a') + i) for i in range(26)]
show_flg = False
show_flg = True
ans = 0
for i in range(I()):
	ans = 0
	(A, H, n) = LI()
	a = LI()
	h = LI()
	d = t = 0
	for i in range(n):
		c = (h[i] + A - 1) // A
		d += c * a[i]
		t += c
	Yn(d - max(a) < H)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	attack = [int(x) for x in input().split()]
	health = [int(x) for x in input().split()]
	zipped = zip(attack, health)
	zipped = sorted(zipped, key=lambda x: x[0])
	for i in zipped:
		fights = i[1] // a
		if fights * a < i[1]:
			fights += 1
		b -= fights * i[0]
	if b >= 0:
		print('YES')
	elif abs(b) < zipped[-1][0]:
		print('YES')
	else:
		print('NO')


import math
for pratyush in range(int(input())):
	(c, d, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	for i in range(n):
		d -= math.ceil(b[i] / c) * a[i]
	if d + max(a) > 0:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(x, y, n) = [int(X) for X in input().split()]
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	a = [[a[i], b[i]] for i in range(n)]
	a.sort(key=lambda x: (x[0], x[1]))
	b = [i[1] for i in a]
	a = [i[0] for i in a]
	f = True
	for i in range(n):
		if y <= 0:
			f = False
			break
		att = (b[i] + x - 1) // x
		y -= att * a[i]
		if y <= -a[i]:
			f = False
			break
	if f:
		print('YES')
	else:
		print('NO')


t = int(input())
ans = []
for j in range(t):
	(A, B, n) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	c = [(a[i], b[i]) for i in range(n)]
	c.sort()
	i = 0
	bn = n - 1
	while i < bn:
		B -= c[i][0] * ((c[i][1] + A - 1) // A)
		if B <= 0:
			break
		i += 1
	if B <= 0:
		ans.append('NO')
	else:
		qh = (c[-1][1] + A - 1) // A
		ma = c[-1][0]
		qm = (B + ma - 1) // ma
		if qh <= qm:
			ans.append('YES')
		else:
			ans.append('NO')
print('\n'.join(ans))


from math import ceil
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def func(a, b, n):
	global arr, brr
	l1 = sorted([(arr[i], brr[i]) for i in range(n)], reverse=False)
	ans = 0
	for i in range(n):
		p = l1[i][0]
		q = l1[i][1]
		if b <= 0:
			return 'NO'
		x = ceil(q / a)
		if ceil(b / p) < x:
			return 'NO'
		b -= p * x
	return 'YES'
	pass

def main():
	global arr, brr
	for _ in range(int(input())):
		(a, b, n) = map(int, input().split())
		arr = list(map(int, input().split()))
		brr = list(map(int, input().split()))
		print(func(a, b, n))
	pass
arr = []
brr = []
main()


for x in range(int(input())):
	(a, b, n) = map(int, input().split())
	m_a = list(map(int, input().split()))
	m_b = list(map(int, input().split()))
	d = 0
	for y in range(n):
		d += (m_b[y] + a - 1) // a * m_a[y]
	if b - (d - max(m_a)) >= 1:
		print('YES')
	else:
		print('NO')


import sys
import math

def scan(input_type='int'):
	if input_type == 'int':
		return list(map(int, sys.stdin.readline().strip().split()))
	else:
		return list(map(str, sys.stdin.readline().strip()))

def solution():
	for _ in range(int(input())):
		(x, y, n) = scan()
		a = scan()
		b = scan()
		for i in range(n):
			y -= a[i] * math.ceil(b[i] / x)
		if y + max(a) > 0:
			print('YES')
		else:
			print('NO')
solution()


import sys
input = sys.stdin.readline
t = int(input())

def f():
	(A, B, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	t = []
	for i in range(n):
		t.append([a[i], b[i]])
	t.sort()
	for i in range(n):
		mat = B // t[i][0]
		uat = t[i][1] // A
		if B % t[i][0] != 0:
			mat += 1
		if t[i][1] % A != 0:
			uat += 1
		B -= min(mat, uat) * t[i][0]
		if B <= 0:
			if mat == uat and i == n - 1:
				return 'YES'
			else:
				return 'NO'
	return 'YES'
for _ in range(t):
	print(f())


for i in range(int(input())):
	(hero_atk, hero_hp, monsters_num) = map(int, input().split())
	mosters_atk = list(map(int, input().split()))
	mosters_hp = list(map(int, input().split()))
	max_atk = max(mosters_atk)
	dmg = 0
	for j in range(monsters_num):
		atk_count = (mosters_hp[j] + hero_atk - 1) // hero_atk
		dmg += atk_count * mosters_atk[j]
	if dmg - max_atk < hero_hp:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout, setrecursionlimit
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from random import seed, randint
from datetime import datetime
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
from collections import defaultdict as dd
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def def_value():
	return 0

def Sort_Tuple(tup):
	tup.sort(key=lambda x: x[0])
	return tup
for _ in range(iinp()):
	(aa, bb, n) = mp()
	a = lmp()
	b = lmp()
	p = []
	for i in range(n):
		p.append((a[i], b[i]))
	Sort_Tuple(p)
	sm = 0
	flg = False
	for i in range(n):
		sm += p[i][0] * (ceil(p[i][1], aa) - 1)
		if sm > bb:
			flg = True
			break
		sm += p[i][0]
	if flg:
		print('NO')
	else:
		print('YES')


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(A, B, n) = map(int, input().split())
	a = [*map(int, input().split())]
	b = [*map(int, input().split())]
	print('NO' if sum(((x + A - 1) // A * y for (x, y) in zip(b, a))) - B >= max(a) else 'YES')


from math import ceil

def hero(heroatt, herohp, n, monsteratt, monsterhp):
	for i in range(n):
		x = ceil(monsterhp[i] / heroatt)
		y = ceil(herohp / monsteratt[i])
		if y < x:
			return 'NO'
	for i in range(n):
		monsteratt[i] = [monsteratt[i], monsterhp[i]]
	monsteratt.sort()
	for i in range(n):
		x = ceil(monsteratt[i][1] / heroatt)
		y = ceil(herohp / monsteratt[i][0])
		if y < x:
			return 'NO'
		herohp -= monsteratt[i][0] * x
		monsteratt[i][1] -= heroatt * x
		if herohp < 1:
			break
	for i in range(n - 1, -1, -1):
		if monsteratt[i][1] > 0:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	(heroatt, herohp, n) = map(int, input().split())
	monsteratt = list(map(int, input().split()))
	monsterhp = list(map(int, input().split()))
	print(hero(heroatt, herohp, n, monsteratt, monsterhp))


t = int(input())
for dahijafnd in range(t):
	ABn = list(map(int, input().split()))
	A = ABn[0]
	B = ABn[1]
	n = ABn[2]
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	hp = 0
	x = 0
	for i in range(n):
		if b[i] / A > b[i] // A:
			x = b[i] // A + 1
		else:
			x = b[i] // A
		hp += a[i] * x
	hp = hp - max(a)
	if B - hp > 0:
		print('YES')
	else:
		print('NO')


from math import ceil
t = int(input())
for _ in range(t):
	(hero_att_aka_A, hero_hp_aka_B, monsters_amount_aka_n) = map(int, input().split())
	monsters_attacks = list(map(int, input().split()))
	monsters_hps = list(map(int, input().split()))
	monsters = [[att, hp] for (att, hp) in zip(monsters_attacks, monsters_hps)]
	monsters.sort(key=lambda el: el[0], reverse=True)
	while monsters:
		monster = monsters[-1]
		hits_to_defeat_monst = ceil(monster[1] / hero_att_aka_A)
		hits_to_lose = ceil(hero_hp_aka_B / monster[0])
		if hits_to_defeat_monst <= hits_to_lose:
			hero_hp_aka_B -= hits_to_defeat_monst * monster[0]
			monsters.pop()
		else:
			print('NO')
			break
	else:
		print('YES')


import sys
import bisect as bi
import math
from collections import defaultdict as dd
from types import GeneratorType
input = sys.stdin.readline
mo = 10 ** 9 + 7
MOD = 998244353

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input().strip()

def inin():
	return int(input())
for _ in range(inin()):
	(a, b, n) = cin()
	am = ain()
	bm = ain()
	both = []
	for i in range(n):
		both += [(am[i], bm[i])]
	both.sort()
	flag = 1
	for i in range(n):
		(AM, BM) = both[i]
		times = (BM + a - 1) // a
		b = b - (times - 1) * AM
		if b > 0:
			b -= AM
		else:
			flag = 0
			break
	if flag:
		print('YES')
	else:
		print('NO')

def msb(n):
	n |= n >> 1
	n |= n >> 2
	n |= n >> 4
	n |= n >> 8
	n |= n >> 16
	n |= n >> 32
	n |= n >> 64
	return n - (n >> 1)

def pref(a, n, f):
	pre = [0] * n
	if f == 0:
		pre[0] = a[0]
		for i in range(1, n):
			pre[i] = a[i] + pre[i - 1]
	else:
		pre[-1] = a[-1]
		for i in range(n - 2, -1, -1):
			pre[i] = pre[i + 1] + a[i]
	return pre

def kadane(A):
	maxSoFar = maxEndingHere = start = end = beg = 0
	for i in range(len(A)):
		maxEndingHere = maxEndingHere + A[i]
		if maxEndingHere < 0:
			maxEndingHere = 0
			beg = i + 1
		if maxSoFar < maxEndingHere:
			maxSoFar = maxEndingHere
			start = beg
			end = i
	return (maxSoFar, start, end)

def modFact(n, p):
	if n < 0:
		return 0
	if n >= p:
		return 0
	result = 1
	for i in range(1, n + 1):
		result = result * i % p
	return result

def ncr(n, r, p):
	if n < r or n < 0:
		return 0
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc


def solve():
	(a, b, n) = input().split()
	a = int(a)
	b = int(b)
	n = int(n)
	plist = input().split()
	hlist = input().split()
	mainlist = list()
	for i in range(0, int(n), 1):
		templist = [int(plist[i]), int(hlist[i]), int(plist[i])]
		mainlist.append(templist)
	mainlist.sort(reverse=False)
	for i in mainlist:
		if b <= 0:
			print('NO')
			return
		temp = int(i[1] / a)
		if i[1] % a == 0:
			temp = temp - 1
		b = b - temp * i[2]
		if b <= 0:
			print('NO')
			return
		b = b - i[2]
	print('YES')

def main():
	t = int(input())
	while t != 0:
		solve()
		t = t - 1
main()


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz/'
M = 1000000007
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
import math
for _ in range(int(input())):
	(a, b, n) = map(int, input().split(' '))
	attack = list(map(int, input().split(' ')))
	health = list(map(int, input().split(' ')))
	done = False
	for x in range(n):
		b -= attack[x] * math.ceil(health[x] / a)
	for x in range(n):
		if b + attack[x] > 0:
			done = True
			break
	if done == False:
		print('NO')
	else:
		print('YES')


def solve():
	(A, B, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	mx = max(a)
	s = 0
	for i in range(n):
		c = (b[i] + A - 1) // A
		s += a[i] * c
	if s - mx < B:
		print('YES')
	else:
		print('NO')
t = int(input())
for i in range(t):
	solve()


import math, sys
from collections import defaultdict, Counter, deque
from bisect import bisect_left, bisect_right
INF = float('inf')
MOD = int(1000000000.0) + 7
MAX = int(1000000.0) + 1

def solve():
	(attack, health, n) = vars()
	a = array()
	b = array()
	total = 0
	mon = []
	for i in range(n):
		mon.append((a[i], b[i]))
	mon = sorted(mon)
	for i in range(n):
		t1 = math.ceil(mon[i][1] / attack)
		damage = t1 * mon[i][0]
		if total + damage >= health:
			if i == n - 1:
				t2 = math.ceil((health - total) / mon[i][0])
				if t1 == t2:
					break
			print('NO')
			return
		total += damage
	print('YES')

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

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def input():
	return sys.stdin.readline().rstrip('\n').strip()

def print(*args, sep=' ', end='\n'):
	first = True
	for arg in args:
		if not first:
			sys.stdout.write(sep)
		sys.stdout.write(str(arg))
		first = False
	sys.stdout.write(end)
primes = [1 for i in range(MAX)]

def sieve():
	global primes
	primes[0] = primes[1] = 0
	i = 2
	while i <= MAX ** 0.5:
		j = i * i
		while primes[i] and j < MAX:
			if j % i == 0:
				primes[j] = 0
			j += i
		i += 1

def vars():
	return map(int, input().split())

def array():
	return list(map(int, input().split()))
main()


import math

def solve(health, attack, a, b, n, ans):
	for i in range(n):
		k = health[i] // a
		health[i] %= a
		if health[i]:
			if b < k * attack[i]:
				ans.append('NO')
				return
			b -= k * attack[i]
		elif b >= (k - 1) * attack[i]:
			b -= (k - 1) * attack[i]
			health[i] = a
		else:
			ans.append('NO')
			return
	attack.sort()
	for i in attack:
		if b <= 0:
			ans.append('NO')
			return
		b -= i
	ans.append('YES')

def main():
	t = int(input())
	ans = []
	for i in range(t):
		(a, b, n) = map(int, input().split())
		attack = list(map(int, input().split()))
		health = list(map(int, input().split()))
		solve(health, attack, a, b, n, ans)
	print('\n'.join(ans))
main()


R = lambda : map(int, input().split())
(t,) = R()
while t:
	t -= 1
	(a, b, n) = R()
	for (x, y) in sorted(zip(R(), R())):
		b += -y // a * x
	print('YNEOS'[b <= -x::2])


import os
import sys
from io import BytesIO, IOBase
from math import gcd, inf, sqrt, ceil

def lcm(a, b):
	return a * b // gcd(a, b)

def getFactorization(x):
	ret = list()
	while x != 1:
		ret.append(spf[x])
		x = x // spf[x]
	return ret

def printDivisors(n):
	i = 2
	z = [1, n]
	while i <= sqrt(n):
		if n % i == 0:
			if n / i == i:
				z.append(i)
			else:
				z.append(i)
				z.append(n // i)
		i = i + 1
	return z

def cheaker(a):
	j = 1
	p = False
	for i in a:
		if i != j:
			break
		j += 1
	q = len(a)
	for i in a[::-1]:
		if i != q:
			break
		q -= 1
	for i in range(j - 1, q):
		if a[i] == i + 1:
			return False
	return True

def create(n, x, f):
	pq = len(bin(n)[2:])
	if f == 0:
		tt = min
	else:
		tt = max
	dp = [[inf] * n for _ in range(pq)]
	dp[0] = x
	for i in range(1, pq):
		for j in range(n - (1 << i) + 1):
			dp[i][j] = tt(dp[i - 1][j], dp[i - 1][j + (1 << i - 1)])
	return dp

def enquiry(l, r, dp, f):
	if l > r:
		return inf if not f else -inf
	if f == 1:
		tt = max
	else:
		tt = min
	pq1 = len(bin(r - l + 1)[2:]) - 1
	return tt(dp[pq1][l], dp[pq1][r - (1 << pq1) + 1])

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	x = []
	for i in range(2, n + 1):
		if prime[i]:
			x.append(i)
	return x

def main():
	for i in range(int(input())):
		(at, b, n) = map(int, input().split())
		a = [int(X) for X in input().split()]
		bi = [int(x) for x in input().split()]
		c = [[a[j], int(ceil(bi[j] / at) * a[j])] for j in range(n)]
		c.sort()
		q = 0
		for j in c:
			b -= j[1]
			q += 1
		if b >= 0:
			print('YES')
		elif b + c[-1][0] >= 0:
			print('YES')
		else:
			print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import math
testcase = int(input())
for _ in range(testcase):
	(heroPower, heroHealth, noMonsters) = map(int, input().split())
	monsPower = list(map(int, input().split()))
	monsHealth = list(map(int, input().split()))
	monster = []
	for i in range(noMonsters):
		monster.append((monsPower[i], monsHealth[i]))
	monster.sort()
	won = 'YES'
	for i in range(len(monster)):
		(attack, life) = monster[i]
		noOfFights = math.ceil(life / heroPower)
		heroHealth -= noOfFights * attack
		life -= life // heroPower * noOfFights
		if heroHealth <= 0:
			if i != len(monster) - 1:
				won = 'NO'
				break
			elif heroHealth + attack <= 0:
				won = 'NO'
				break
	print(won)


import math

def swapp(A, B, n, a, b):
	d.sort()
	h = B
	for i in range(len(a)):
		h -= math.ceil(d[i][1] / A) * d[i][0]
	h += d[n - 1][0]
	if h > 0:
		return 'YES'
	else:
		return 'NO'
t = int(input())
for i in range(t):
	d = []
	NM = input().split()
	A = int(NM[0])
	B = int(NM[1])
	n = int(NM[2])
	a = list(map(int, input().rstrip().split()))
	b = list(map(int, input().rstrip().split()))
	for i in range(len(a)):
		d.append((a[i], b[i]))
	ans = swapp(A, B, n, a, b)
	print(ans)


import math
for _ in range(int(input())):
	(A, B, n) = map(int, input().split())
	monster_a = list(map(int, input().split()))
	monster_b = list(map(int, input().split()))
	sum_damage = 0
	for i in range(n):
		sum_damage += monster_a[i] * math.ceil(monster_b[i] / A)
	print('YES') if B - sum_damage >= -max(monster_a) else print('NO')


import logging
import sys
from inspect import currentframe
input = sys.stdin.readline
logging.basicConfig(level=logging.DEBUG)

def dbg(*args):
	id2names = {id(v): k for (k, v) in currentframe().f_back.f_locals.items()}
	logging.debug(', '.join((id2names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args)))

def solve():
	(A, B, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	battle = [0] * n
	damage = [0] * n
	for i in range(n):
		battle[i] = (A + b[i] - 1) // A
		damage[i] = battle[i] * a[i]
	s = sum(damage)
	for i in range(n):
		lasthp = B - s + damage[i]
		if battle[i] <= (lasthp + a[i] - 1) // a[i]:
			return True
	return False

def main():
	t = int(input())
	for _ in range(t):
		if solve():
			print('YES')
		else:
			print('NO')
main()


import math
t = int(input())
for z in range(t):
	(A, B, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	s = 0
	ok = 1
	mn = 0
	for i in range(n):
		mn = max(mn, a[i])
	k = a.index(mn)
	for i in range(n):
		if i != k:
			s = s + math.ceil(b[i] / A) * a[i]
	l = math.ceil(b[k] / A)
	h = (l - 1) * a[k]
	if B - s - h <= 0:
		ok = 0
	if ok == 1:
		print('YES')
	else:
		print('NO')


import math
for _ in range(int(input())):
	(att, health, mon) = map(int, input().split())
	monatt = list(map(int, input().split()))
	monhel = list(map(int, input().split()))
	max1 = -float('Inf')
	for i in range(len(monatt)):
		if monatt[i] > max1:
			store = i
			max1 = monatt[i]
	for i in range(len(monatt)):
		if i == store:
			continue
		health -= math.ceil(monhel[i] / att) * monatt[i]
	if health <= 0:
		print('NO')
		continue
	health -= math.ceil(monhel[store] / att) * monatt[store]
	if health + monatt[store] > 0:
		print('YES')
	else:
		print('NO')


import math
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	arr = list(map(int, input().split()))
	brr = list(map(int, input().split()))
	k = 0
	crr = []
	for i in range(n):
		crr.append([arr[i], brr[i]])
	crr.sort()
	for i in range(n):
		if b <= 0:
			k = 1
			break
		else:
			b -= crr[i][0] * math.ceil(crr[i][1] / a)
			crr[i][1] -= a * math.ceil(crr[i][1] / a)
			if crr[i][1] >= 1 or b + crr[i][0] < 0:
				k = 1
	if k == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(A, B, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	l1 = [0] * n
	l2 = [0] * n
	for i in range(n):
		l1[i] = -(-b[i] // A)
		l2[i] = l1[i] * a[i]
	if sum(l2) <= B:
		print('YES')
	elif sum(l2) - max(a) >= B:
		print('NO')
	else:
		print('YES')


import sys
for _ in range(int(sys.stdin.readline())):
	p = list(map(int, list(sys.stdin.readline().split())))
	(h_p, h_h, num) = (p[0], p[1], p[2])
	e_p = list(map(int, list(sys.stdin.readline().split())))
	e_h = list(map(int, list(sys.stdin.readline().split())))
	enemy = [[0] * 2 for _ in range(num)]
	for i in range(p[2]):
		(enemy[i][0], enemy[i][1]) = (e_p[i], e_h[i])
	enemy.sort(key=lambda x: x[0])
	i = 0
	while i < num and h_h > 0:
		(e_p, e_h) = (enemy[i][0], enemy[i][1])
		if e_h % h_p == 0:
			nu = e_h // h_p
		else:
			nu = e_h // h_p + 1
		h_h -= nu * e_p
		if h_h > -e_p:
			i += 1
	if i == num:
		print('YES')
	else:
		print('NO')


test_cases = int(input())
res = []
for test in range(test_cases):
	st = input()
	ls = st.split()
	a = int(ls[0])
	h = int(ls[1])
	n = int(ls[2])
	st = input()
	ls = st.split()
	val_lst = []
	for value in ls:
		val_lst.append([int(value)])
	st = input()
	ls = st.split()
	for i in range(n):
		value = int(ls[i])
		val_lst[i].append(value)
	val_lst.sort()
	f = 0
	for value in val_lst:
		if h <= 0:
			f = 1
			break
		if value[1] % a == 0:
			h -= value[0] * value[1] // a
		else:
			h -= value[0] * (value[1] // a + 1)
		if h + value[0] <= 0:
			f = 1
			break
	if f == 1:
		res.append('NO')
	else:
		res.append('YES')
for value in res:
	print(value)


R = lambda : map(int, input().split())
(t,) = R()
for _ in [0] * t:
	(a, b, n) = R()
	f = 0
	for (x, y) in sorted(zip(R(), R())):
		b += -y // a * x
		f |= b <= -x
	print('YNEOS'[f::2])


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	monster = [[0, 0] for _ in range(c)]
	tmp1 = list(map(int, input().split()))
	tmp2 = list(map(int, input().split()))
	for i in range(c):
		monster[i][0] = tmp1[i]
		monster[i][1] = tmp2[i]
	monster = sorted(monster, key=lambda x: (x[0], x[1]))
	for (power, health) in monster:
		tmp = health // a if health % a == 0 else health // a + 1
		b -= power * tmp
	if b >= -monster[-1][0]:
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
import time
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict as dd, deque as dq, Counter as dc
import math, string

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def getMat(n):
	return [getInts() for _ in range(n)]

def isInt(s):
	return '0' <= s[0] <= '9'
MOD = 10 ** 9 + 7

def solve():
	(A, B, N) = getInts()
	arr = list(zip(getInts(), getInts()))
	arr.sort()
	for (i, X) in enumerate(arr):
		(a, b) = X
		num = b // A + (b % A > 0)
		B -= num * a
		if B < 0 and i < N - 1:
			return 'NO'
		if B + a <= 0 and i == N - 1:
			return 'NO'
	return 'YES'
for _ in range(getInt()):
	print(solve())


from math import ceil

def solve(n, A, B, a, b):
	b.sort(key=lambda s: a[s[0]])
	x = [a[b[i][0]] for i in range(n)]
	i = 0
	for i in range(n):
		u = ceil(b[i][1] / A)
		B -= u * x[i]
	if B + x[-1] > 0:
		print('YES')
	else:
		print('NO')
for _ in range(int(input())):
	(A, B, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(enumerate(map(int, input().split())))
	solve(n, A, B, a, b)


n = int(input())
ans = []
for i in range(n):
	(at, hp, num) = (int(num) for num in input().split())
	mat = [int(num) for num in input().split()]
	mhp = [int(num) for num in input().split()]
	gank = []
	min = 10 * 10
	for j in range(num):
		num1 = mat[j] * (mhp[j] // at)
		if mhp[j] % at != 0:
			num1 += mat[j]
		gank.append(num1)
		hp -= num1
		hplist = []
	for j in gank:
		hplist.append(hp + j)
	jg = 0
	for j in range(num):
		if hplist[j] <= 0:
			continue
		mtime = gank[j] // mat[j]
		time = hplist[j] // mat[j]
		if hplist[j] % mat[j] != 0:
			time += 1
		if time >= mtime:
			ans.append('YES')
			jg = 1
			break
	if jg == 0:
		ans.append('NO')
for i in ans:
	print(i)


import math
for _ in range(int(input())):
	(A, B, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	for i in range(n):
		B -= math.ceil(b[i] / A) * a[i]
	if B + max(a) > 0:
		print('YES')
	else:
		print('NO')


import math
import operator
import sys
inf = sys.stdin
input = inf.readline

def main():
	t = int(input())
	for _ in range(t):
		(h_at, h_hp, m_n) = list(map(int, input().split()))
		ms_at = list(map(int, input().split()))
		ms_hp = list(map(int, input().split()))
		ms = sorted(sorted(list(map(list, zip(ms_at, ms_hp))), key=lambda a: a[1] / a[0]), key=lambda a: a[0])
		for (i, (m_at, m_hp)) in enumerate(ms):
			f_h = math.ceil(m_hp / h_at)
			f_a = math.ceil(h_hp / m_at)
			if 0 < f_h <= f_a:
				h_hp -= f_h * m_at
				ms[i][1] -= f_h * h_at
			else:
				break
		if any((m_hp > 0 for m_hp in list(zip(*ms))[1])):
			print('NO')
		else:
			print('YES')
main()


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	(A, B, n) = [int(i) for i in sys.stdin.readline().split()]
	a = [int(i) for i in sys.stdin.readline().split()]
	b = [int(i) for i in sys.stdin.readline().split()]
	damage = 0
	for i in range(n):
		num_times = (b[i] + A - 1) // A
		damage += num_times * a[i]
	if damage - max(a) < B:
		print('YES')
	else:
		print('NO')


from math import ceil
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	at = list(map(int, input().split()))
	he = list(map(int, input().split()))
	arr = []
	for i in range(n):
		arr.append(at[i] * ceil(he[i] / a))
	s = sum(arr)
	if s <= b:
		print('YES')
	else:
		at.sort()
		if s - at[-1] < b:
			print('YES')
		else:
			print('NO')


from collections import deque
for _ in range(int(input())):
	from math import ceil
	(A, B, n) = map(int, input().split(' '))
	a = [int(num) for num in input().split(' ')]
	b = [int(num) for num in input().split(' ')]
	arr = []
	for i in range(n):
		arr.append([b[i], a[i]])
	arr.sort(key=lambda x: x[1])
	for i in range(n):
		x = ceil(arr[i][0] / A)
		B1 = B - x * arr[i][1]
		B2 = B - (x - 1) * arr[i][1]
		if B2 < 1:
			i = i - 1
			break
		B = B1
	if i == n - 1:
		ans = 'Yes'
	else:
		ans = 'No'
	print(ans)


def main():
	t = int(input())
	for i in range(t):
		(A, B, n) = list(map(int, input().split()))
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
		for i in range(n):
			B -= a[i] * ((b[i] + A - 1) // A)
		for i in range(n):
			h = B + a[i]
			if h > 0:
				print('YES')
				break
		if h <= 0:
			print('NO')
main()


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(A, B, n) = map(int, input().split())
	a = [*map(int, input().split())]
	b = [*map(int, input().split())]
	for i in range(n):
		t = b[i] // A + (b[i] % A != 0)
		B -= t * a[i]
	B += max(a)
	print('NO' if B <= 0 else 'YES')


import io, os, sys
import math
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
t = int(input())
while t:
	t -= 1
	ANS = 'NO'
	(HA, HH, n) = [int(i) for i in input().split()]
	MA = [int(i) for i in input().split()]
	MH = [int(i) for i in input().split()]
	MALL = []
	for i in range(n):
		MALL.append([MA[i], MH[i]])
	MALL.sort()
	for i in range(n):
		if HH <= 0:
			break
		W = math.ceil(MALL[i][1] / HA)
		WM = math.ceil(HH / MALL[i][0])
		HH -= W * MALL[i][0]
		if i == n - 1 and W <= WM:
			ANS = 'YES'
	sys.stdout.write(ANS + '\n')


from math import ceil, floor
for _ in range(int(input())):
	(A, B, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	ok = True
	t = []
	for i in range(n):
		t.append([a[i], b[i]])
	t.sort(key=lambda x: x[0])
	ok = True
	for i in range(n):
		if B <= 0:
			ok = False
			break
		min_attack = min(ceil(B / t[i][0]), ceil(t[i][1] / A))
		B -= min_attack * t[i][0]
		t[i][1] -= min_attack * A
	if not ok:
		print('NO')
	elif t[n - 1][1] > 0:
		print('NO')
	else:
		print('YES')


import math

def the_great_hero(A, B, attack, health):
	times = [int(math.ceil(h / A)) for h in health]
	hero_health = [time * a for (time, a) in zip(times, attack)]
	return 'YES' if B - sum(hero_health) + max(attack) > 0 else 'NO'
num_test = int(input())
for i in range(num_test):
	(A, B, n) = [int(i) for i in input().split()]
	attack = [int(i) for i in input().split()]
	health = [int(i) for i in input().split()]
	print(the_great_hero(A, B, attack, health))


import math
from math import gcd, inf, sqrt, pi, cos, sin, ceil, log2, floor, log

def solve():
	(A, B, n) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	brr = list(map(int, input().split()))
	sm_b = sum(brr)
	count = 0
	for i in range(0, n):
		count += ceil(brr[i] / A) * arr[i]
	for i in range(0, n):
		if B - count + arr[i] > 0:
			print('YES')
			return
	print('NO')
	return
for _ in range(int(input())):
	solve()


import math
for _ in range(int(input())):
	(ha, hb, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	attack = [0] * n
	s = 0
	for i in range(n):
		x = math.ceil(b[i] / ha)
		attack[i] = a[i] * x
		s += attack[i]
	ans = 0
	for i in range(n):
		res = hb - s + a[i]
		ans = max(ans, res)
	if ans > 0:
		print('YES')
	else:
		print('NO')


import sys
import math
from collections import defaultdict
MAXNUM = math.inf
MINNUM = -1 * math.inf
ASCIILOWER = 97
ASCIIUPPER = 65

def getInt():
	return int(sys.stdin.readline().rstrip())

def getInts():
	return map(int, sys.stdin.readline().rstrip().split(' '))

def getString():
	return sys.stdin.readline().rstrip()

def printOutput(ans):
	sys.stdout.write()
	pass

def solve(A, B, ap, health):
	monsters = []
	for (a, b) in zip(ap, health):
		monsters.append((a, b))
	monsters.sort()
	curHealth = B
	for monster in monsters:
		(att, monHealth) = monster
		curHealth -= math.ceil(monHealth / A) * att
	if curHealth + monsters[-1][0] <= 0:
		return 'NO'
	return 'YES'

def readinput():
	tc = getInt()
	for _ in range(tc):
		(A, B, n) = getInts()
		ap = list(getInts())
		health = list(getInts())
		print(solve(A, B, ap, health))
readinput()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(A, B, n) = map(int, input().split())
	ar = list(map(int, input().split()))
	br = list(map(int, input().split()))
	li = []
	for i in range(n):
		li.append([ar[i], br[i]])
	li.sort(key=lambda x: x[0])
	flag = True
	for i in range(n - 1):
		h = int(abs(-B // li[i][0]))
		m = int(abs(-li[i][1] // A))
		if m >= h:
			flag = False
			break
		else:
			B -= m * li[i][0]
		if B <= 0:
			flag = False
			break
	i = n - 1
	h = int(abs(-B // li[i][0]))
	m = int(abs(-li[i][1] // A))
	if h < m:
		flag = False
	if flag:
		print('YES')
	else:
		print('NO')


import math as m
for _ in range(int(input())):
	(A, B, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	flag = 1
	r = 0
	fl = max(a)
	for i in range(n):
		r = m.ceil(b[i] / A)
		B -= r * a[i]
	if B <= -fl:
		print('NO')
	else:
		print('YES')


import math

def solve(A, B, n, As, Bs):
	monsters = [[a, b] for (a, b) in zip(As, Bs)]
	monsters = sorted(monsters, key=lambda p: p[0])
	for monster in monsters:
		if B <= 0:
			return 'NO'
		(a, b) = (monster[0], monster[1])
		cnt = math.ceil(b / A)
		if B - (cnt - 1) * a <= 0:
			return 'NO'
		B -= cnt * a
	return 'YES'

def main():
	ans = []
	t = int(input())
	for _ in range(t):
		(A, B, n) = map(int, input().split(' '))
		As = list(map(int, input().split(' ')))
		Bs = list(map(int, input().split(' ')))
		ans.append(solve(A, B, n, As, Bs))
	for a in ans:
		print(a)
main()


import math
from collections import defaultdict
DEBUG = False

def log(*args, **kwargs):
	if DEBUG:
		print(*args, **kwargs)

def rint():
	return int(input())

def rlist(f=int):
	return list(map(f, input().split()))

def rstr():
	return input()

class Solution:

	def __init__(self):
		pass

	def run(self):
		(A, B, n) = rlist()
		a = rlist()
		b = rlist()
		pairs = []
		for (x, y) in sorted(enumerate(a), key=lambda x: x[1]):
			pairs.append((y, b[x]))
		log(pairs)
		for i in range(n):
			(x, y) = pairs[i]
			attacks = (y + A - 1) // A
			defends = (B + x - 1) // x
			log(f'hero: {A} {B} | monster: {a[i]} {b[i]} | a: {attacks} d: {defends}')
			if B <= 0 or attacks > defends:
				return 'NO'
			B -= attacks * x
		log(f'end: {B}')
		return 'YES'
t = int(input())
s = Solution()
for i in range(t):
	print(s.run())


for i in ' ' * int(input()):
	(p, h, n) = map(int, input().split())
	p1 = list(map(int, input().split()))
	h1 = list(map(int, input().split()))
	req = 0
	for j in range(n):
		z = (h1[j] + p - 1) // p
		req += p1[j] * z
	if max(p1) + h - req > 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(A, B, n) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	(s, f) = (0, 'NO')
	for i in range(n):
		c = (b[i] + A - 1) // A
		s += c * a[i]
	for i in range(n):
		c = (b[i] + A - 1) // A
		d = s - c * a[i]
		if B > s - a[i]:
			f = 'YES'
			break
	print(f)


q = int(input())
for queries in range(0, q):
	(a, b, n) = map(int, input().split())
	ma = list(map(int, input().split()))
	mb = list(map(int, input().split()))
	mx = ma[0]
	for i in range(0, n):
		t = (mb[i] + a - 1) // a
		b -= t * ma[i]
		mx = max(ma[i], mx)
	b += mx
	if b > 0:
		print('YES')
	else:
		print('NO')


from math import ceil
for ii in range(int(input())):
	(a, b, n) = map(int, input().split())
	x = list(map(int, input().split()))
	y = list(map(int, input().split()))
	zipped_lists = zip(x, y)
	sorted_pairs = sorted(zipped_lists)
	tuples = zip(*sorted_pairs)
	(x, y) = [list(tuple) for tuple in tuples]
	f = True
	for jj in range(n):
		h1 = ceil(y[jj] / a)
		h2 = ceil(b / x[jj])
		if h2 < h1 or b <= 0:
			print('NO')
			f = False
			break
		else:
			b -= h1 * x[jj]
	if f:
		print('YES')


import math
import sys
inf = float('inf')
mod = 10 ** 9 + 7
input = sys.stdin.readline
for _ in range(int(input())):
	(A, B, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	monsters = []
	for i in range(n):
		monsters.append([a[i], b[i]])
	monsters.sort(key=lambda arr: arr[0])
	for i in range(n - 1):
		x = math.ceil(monsters[i][1] / A)
		B -= monsters[i][0] * x
	if B <= 0:
		print('NO')
	else:
		x = math.ceil(monsters[-1][1] / A)
		y = math.ceil(B / monsters[-1][0])
		if x > y:
			print('NO')
		else:
			print('YES')


from sys import stdin
input = lambda : stdin.readline().strip()
lin = lambda : list(map(int, input().split()))
iin = lambda : int(input())
main = lambda : map(int, input().split())
from math import ceil, sqrt, factorial, log
from collections import deque
from bisect import bisect_left

def gcd(a, b):
	(a, b) = (max(a, b), min(a, b))
	while a % b != 0:
		(a, b) = (b, a % b)
	return b
mod = 998244353

def solve(we):
	(a, b, n) = main()
	x = lin()
	y = lin()
	l = []
	for i in range(n):
		l.append([y[i], x[i]])
	l.sort(key=lambda w: (w[1], w[0]))
	t = 0
	z = 0
	flag = 0
	for i in range(n):
		t = ceil(l[i][0] / a)
		if i < n - 1 and z + t * l[i][1] >= b:
			flag = 0
			break
		elif i == n - 1:
			b -= z
			t1 = ceil(l[i][0] / a)
			b -= t1 * l[i][1]
			if b >= 0:
				flag = 1
			else:
				b = abs(b)
				if b < l[i][1]:
					flag = 1
		z += t * l[i][1]
	if flag == 0:
		print('NO')
	else:
		print('YES')
qwe = 1
qwe = iin()
for _ in range(qwe):
	solve(_ + 1)


numTests = int(input())
import math
output = []

def calculate(ehp, eac, hac):
	return math.ceil(ehp / hac) * eac
for i in range(numTests):
	info = input().split()
	heroAttack = int(info[0])
	heroHealth = int(info[1])
	enemyDamages = input().split()
	enemyHealths = input().split()
	enemyDamages = [int(i) for i in enemyDamages]
	enemyHealths = [int(i) for i in enemyHealths]
	index = enemyDamages.index(max(enemyDamages))
	enemyDamages.append(enemyDamages[index])
	enemyDamages.pop(index)
	enemyHealths.append(enemyHealths[index])
	enemyHealths.pop(index)
	for x in range(len(enemyDamages)):
		if heroHealth > calculate(enemyHealths[x], enemyDamages[x], heroAttack):
			heroHealth -= calculate(enemyHealths[x], enemyDamages[x], heroAttack)
		elif heroHealth + enemyDamages[x] > calculate(enemyHealths[x], enemyDamages[x], heroAttack) and x == len(enemyDamages) - 1:
			heroHealth = 1
		else:
			heroHealth = 0
			break
	if heroHealth > 0:
		output.append('YES')
	else:
		output.append('NO')
for i in output:
	print(i)


import math
import sys
t = int(sys.stdin.readline())
for _ in range(t):
	(A, B, n) = map(int, sys.stdin.readline().split())
	an = list(map(int, sys.stdin.readline().split()))
	bn = list(map(int, sys.stdin.readline().split()))
	monster = []
	for i in range(n):
		monster.append((an[i], bn[i]))
	monster.sort()
	answer = 'YES'
	for i in range(len(monster)):
		(attack, life) = monster[i]
		count = math.ceil(life / A)
		B -= attack * count
		if B <= 0:
			if i != len(monster) - 1:
				answer = 'NO'
				break
			elif B + attack <= 0:
				answer = 'NO'
				break
	print(answer)


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	x = list(map(int, input().split()))
	y = list(map(int, input().split()))
	j = 0
	d = 0
	while j < c:
		s = y[j] // a
		if y[j] % a != 0:
			s += 1
		d += x[j] * s
		j += 1
	if d - max(x) < b:
		print('YES')
	else:
		print('NO')


import itertools
from collections import Counter
from fractions import Fraction
from collections import defaultdict
import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	(A, B, n) = [int(x) for x in input().split()]
	a = list([int(x) for x in input().split()])
	b = list([int(x) for x in input().split()])
	health_cons = 0
	for i in range(n):
		health_cons += int(math.ceil(b[i] / A)) * a[i]
	fl = 1
	for i in a:
		if B > health_cons - i:
			fl = 0
			break
	if fl == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(ah, bh, n) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	dmg = 0
	for i in range(n):
		dmg += (b[i] + ah - 1) // ah * a[i]
	if bh > dmg:
		print('YES')
	elif dmg - bh < max(a):
		print('YES')
	else:
		print('NO')


import sys, math
for _ in range(int(input())):
	(A, B, n) = list(map(int, sys.stdin.readline().split()))
	a = list(map(int, sys.stdin.readline().split()))
	b = list(map(int, sys.stdin.readline().split()))
	amax = max(a)
	for i in range(n):
		damage = math.ceil(b[i] / A)
		B -= damage * a[i]
		if B + amax < 1:
			break
	print(['YES', 'NO'][B + amax < 1])


from math import ceil
t = int(input())
result = []
for ex in range(t):
	first = input().split()
	A = int(first[0])
	B = int(first[1])
	n = int(first[2])
	a = input().split()
	b = input().split()
	monsters = []
	for i in range(n):
		monsters.append([int(a[i]), int(b[i])])
	monsters = sorted(monsters, key=lambda l: l[0])
	for i in range(n - 1):
		monster = monsters.pop(0)
		round = ceil(monster[1] / A)
		B = B - round * monster[0]
	monster = monsters.pop(0)
	if monster[1] % A == 0:
		round = monster[1] // A - 1
		B = B - round * monster[0]
		if B > 0:
			result.append('YES')
		else:
			result.append('NO')
	else:
		round = monster[1] // A
		B = B - round * monster[0]
		if B > 0:
			result.append('YES')
		else:
			result.append('NO')
for ans in result:
	print(ans)


for _ in range(int(input())):
	(A, B, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	totalDamage = 0
	flag = True
	for i in range(n):
		totalDamage += (b[i] + A - 1) // A * a[i]
	for i in range(n):
		if B - (totalDamage - a[i]) > 0:
			print('YES')
			flag = False
			break
	if flag:
		print('NO')


import math

def solve(A, B, n, monster_attack, monster_health):
	damage = 0
	for i in range(n):
		damage += math.ceil(monster_health[i] / A) * monster_attack[i]
	damage -= max(monster_attack)
	if B > damage:
		return 'YES'
	else:
		return 'NO'
t = int(input())
for a in range(t):
	(A, B, n) = list(map(int, input().split()))
	monster_attack = list(map(int, input().split()))
	monster_health = list(map(int, input().split()))
	print(solve(A, B, n, monster_attack, monster_health))


import math
t = int(input())
while t != 0:
	t = t - 1
	(at_h, in_h, n) = map(int, input().split())
	at_m = list(map(int, input().split()))
	in_m = list(map(int, input().split()))
	(at_m, in_m) = zip(*sorted(zip(at_m, in_m)))
	at_m = list(at_m)
	in_m = list(in_m)
	final_health = in_h
	d = 0
	for i in range(n - 1):
		final_health = final_health - math.ceil(in_m[i] / at_h) * at_m[i]
	if final_health < 0:
		print('NO')
	else:
		d = final_health - (math.ceil(in_m[n - 1] / at_h) - 1) * at_m[n - 1]
		if d > 0:
			print('YES')
		else:
			print('NO')


import os
import sys
from io import BytesIO, IOBase
from collections import Counter
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

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

def lcm(a, b):
	return a * b / gcd(a, b)

def main():
	for _ in range(int(input())):
		(A, B, n) = map(int, input().split())
		a = list(map(int, input().split()))
		b = list(map(int, input().split()))
		f = 1
		fin = []
		for i in range(n):
			if b[i]:
				fin.append([a[i], b[i]])
		fin.sort()
		for i in range(len(fin)):
			if B <= 0:
				f = 0
				break
			k = fin[i][1] // A
			k += fin[i][1] % A != 0
			if B - (k - 1) * fin[i][0] <= 0:
				f = 0
				break
			B -= k * fin[i][0]
		if f:
			print('YES')
		else:
			print('NO')
	return
main()


import math
tests = int(input())
for _ in range(tests):
	(A, B, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	for i in range(n):
		cnt = math.ceil(b[i] / A)
		B -= cnt * a[i]
	if B >= 0:
		print('YES')
		continue
	for i in range(n):
		if a[i] > -B:
			print('YES')
			break
	else:
		print('NO')


import sys

def main():
	(hero_attack, hero_hp, n) = map(int, sys.stdin.readline().strip().split())
	data = sorted(zip(list(map(int, sys.stdin.readline().strip().split())), list(map(int, sys.stdin.readline().strip().split()))), key=lambda x: x[0])
	current_max = (0, 0)
	for (mob_attack, mob_hp) in data:
		fight_count = int((mob_hp + hero_attack - 1) / hero_attack)
		hero_hp -= fight_count * mob_attack
		if hero_hp + mob_attack <= 0:
			print('NO')
			return
	print('YES')
n = int(sys.stdin.readline().strip())
for _ in range(n):
	main()


from math import ceil
for _ in range(int(input())):
	(a, p, n) = map(int, input().split())
	li = list(map(int, input().split()))
	ai = list(map(int, input().split()))
	com = []
	for i in range(n):
		com.append([ai[i], li[i]])
	com = sorted(com, key=lambda x: x[1])
	win = True
	for i in range(n):
		if p > 0:
			k = ceil(com[i][0] / a)
			l = ceil(p / com[i][1])
			if k > l:
				win = False
				break
			p -= com[i][1] * k
		else:
			win = False
			break
	if not win:
		print('NO')
	else:
		print('YES')


import sys
input = sys.stdin.readline
from sys import stdin, stdout
from collections import defaultdict, Counter
M = 10 ** 9 + 7

def main():
	for _ in range(int(input())):
		(a, b, n) = [int(s) for s in input().split()]
		at = [int(s) for s in input().split()]
		h = [int(s) for s in input().split()]
		w = sum([(h[i] // a + (1 if h[i] % a else 0)) * at[i] for i in range(n)])
		for i in range(n):
			if w - at[i] < b:
				print('YES')
				break
		else:
			print('NO')
main()


t = int(input())
for l in range(t):
	(A, B, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	if n == 1:
		c = (b[0] + A - 1) // A - 1
		B -= a[0] * c
		if B <= 0:
			print('NO')
		else:
			print('YES')
	else:
		x = max(a)
		y = a.index(x)
		for i in range(n):
			if i != y:
				c = (b[i] + A - 1) // A
				B -= a[i] * c
		c = (b[y] + A - 1) // A - 1
		B -= a[y] * c
		if B <= 0:
			print('NO')
		else:
			print('YES')


import sys
input = sys.stdin.readline
(T,) = map(int, input().split())
for _ in range(T):
	(A, B, N) = map(int, input().split())
	X = list(map(int, input().split()))
	Y = list(map(int, input().split()))
	L = list(zip(X, Y))
	L = sorted(L, key=lambda x: x[0])
	t = 0
	for (x, y) in L[:-1]:
		k = -(-y // A)
		t += k * x
		if t >= B:
			print('NO')
			break
	else:
		(x, y) = L[-1]
		k = -(-y // A)
		t += k * x
		if B - t <= -x:
			print('NO')
		else:
			print('YES')


import sys
input = sys.stdin.readline
output = sys.stdout.write
flush = sys.stdout.flush
for _ in range(int(input())):
	(p, h, n) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	S = sum(B)
	cnt = [0] * n
	for (i, b) in enumerate(B):
		cnt[i] = (b + p - 1) // p
	total = sum((a * c for (a, c) in zip(A, cnt)))
	r = h - total + max(A)
	print('YES' if r > 0 else 'NO')


from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque as dq, Counter as C
from math import factorial as f, ceil, gcd, sqrt, log
from itertools import permutations as p
from bisect import bisect_left as bl, bisect_right as br
from sys import stdin, stdout
input = stdin.readline
mp = lambda : map(int, input().split())
it = lambda : int(input())
ls = lambda : list(input().strip())
lcm = lambda a, b: a * b // gcd(a, b)
for _ in range(it()):
	(a, b, c) = mp()
	att = list(mp())
	hel = list(mp())
	k = list(zip(att, hel))
	k.sort(reverse=True)
	ans = ''
	while b >= 0 and k:
		item = k.pop()
		reqatt = ceil(item[1] / a)
		if b <= (reqatt - 1) * item[0]:
			ans = 'NO'
			break
		b -= item[0] * reqatt
	if ans == 'NO':
		print('NO')
		continue
	if k == []:
		print('YES')
	else:
		print('NO')


N = int(input())
for n in range(N):
	(attack, health, mNum) = [int(x) for x in input().split()]
	monster = [[int(x)] for x in input().split()]
	a = [int(x) for x in input().split()]
	for i in range(mNum):
		monster[i].append(a[i])
	monster.sort()
	for x in monster:
		if x[1] % attack == 0:
			health -= x[0] * (x[1] // attack)
		else:
			health -= x[0] * (x[1] // attack + 1)
	if health > -monster[-1][0]:
		print('YES')
	else:
		print('NO')


import math
for _t in range(int(input())):
	(atk, hp, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	x = 0
	y = 0
	for i in range(n):
		if y < a[i]:
			y = a[i]
		x += a[i] * math.ceil(b[i] / atk)
	if x - y < hp:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	(A, B, n) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	damage = 0
	for i in range(n):
		num = (b[i] + A - 1) // A
		damage += num * a[i]
	if damage - max(a) < B:
		print('YES')
	else:
		print('NO')


import sys
pin = sys.stdin.readline
for T in range(int(pin())):
	(A, B, N) = map(int, pin().split())
	Am = [*map(int, pin().split())]
	Bm = [*map(int, pin().split())]
	M = [(Am[i], Bm[i]) for i in range(N)]
	M.sort()
	for i in range(N - 1):
		B -= M[i][0] * (M[i][1] // A + bool(M[i][1] % A))
	C = M[N - 1][1] // A + bool(M[N - 1][1] % A)
	if B <= 0:
		print('NO')
	elif B <= M[N - 1][0] * (C - 1):
		print('NO')
	else:
		print('YES')


import os
import sys
from io import BytesIO, IOBase
import math as M
import itertools as ITR
from collections import defaultdict as D
from collections import Counter as C
from collections import deque as Q
import threading
from functools import lru_cache, reduce
from functools import cmp_to_key as CMP
from bisect import bisect_left as BL
from bisect import bisect_right as BR
import random as R
import string
import cmath, time
enum = enumerate
start_time = time.time()
MOD = 1000000007
MA = float('inf')
MI = float('-inf')
di8 = ((1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1))
di4 = ((1, 0), (0, 1), (-1, 0), (0, -1))

def increase_stack():
	sys.setrecursionlimit(2 ** 32 // 2 - 1)
	threading.stack_size(1 << 27)

def binary(n):
	return bin(n)[2:]

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def maxfactor(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
	if q:
		return q[-1]

def factors(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
			q.append(n // i)
	return list(sorted(list(set(q))))

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(M.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	l.sort()
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def seive(n):
	a = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p ** 2, n + 1, p):
				prime[i] = False
		p = p + 1
	for p in range(2, n + 1):
		if prime[p]:
			a.append(p)
	prime[0] = prime[1] = False
	return (a, prime)

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(M.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countchar(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def str_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q

def lis(arr):
	n = len(arr)
	lis = [1] * n
	maximum = 0
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
				maximum = max(maximum, lis[i])
	return maximum

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

def agcd(a, *b):
	for i in b:
		a = gcd(a, i)
	return a

def lcm(a, *b):
	val = a
	gc = a
	for i in b:
		gc = gcd(gc, i)
		val *= i
	return val // gc

def ncr(n, r):
	return M.factorial(n) // (M.factorial(n - r) * M.factorial(r))

def npr(n, r):
	return M.factorial(n) // M.factorial(n - r)

def IF(c, t, f):
	return t if c else f

def YES(c):
	print(IF(c, 'YES', 'NO'))

def Yes(c):
	print(IF(c, 'Yes', 'No'))

def yes(c):
	print(IF(c, 'yes', 'no'))

def JA(a, sep=' '):
	print(sep.join(map(str, a)))

def JAA(a, s='\n', t=' '):
	return s.join((t.join(map(str, b)) for b in a))

def PS(a, s=' '):
	print(str(a), end=s)

def I():
	return int(inp())

def F():
	return float(inp())

def LI():
	return list(map(int, inp().split()))

def LF():
	return list(map(float, inp().split()))

def MATI(n):
	return [LI() for i in range(n)]

def MATS(n):
	return [list(inp()) for i in range(n)]

def IV():
	return map(int, inp().split())

def FV():
	return map(float, inp().split())

def LS():
	return list(inp())

def S():
	return inp()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
inp = lambda : sys.stdin.readline().rstrip('\r\n')
TestCases = 1

def solve():
	(p, h, n) = IV()
	parr = LI()
	harr = LI()
	arr = []
	for i in range(n):
		arr.append((parr[i], harr[i]))
	arr.sort(key=lambda x: x[0])
	for (x, y) in arr:
		if h <= 0:
			print('NO')
			return
		val = M.ceil(y / p)
		q = (val - 1) * x
		if q >= h:
			print('NO')
			return
		else:
			h -= val * x
	print('YES')

def main():
	flag = 1
	try:
		sys.stdin = open('c:/Users/Manoj Chowdary/Documents/python/CodeForces/contest-div-2/input.txt', 'r')
		sys.stdout = open('c:/Users/Manoj Chowdary/Documents/python/CodeForces/contest-div-2/output.txt', 'w')
	except:
		flag = 0
	t = 1
	if TestCases:
		t = I()
	for _ in range(1, t + 1):
		solve()
	if flag:
		print('Time: %.4f sec' % (time.time() - start_time))
		localtime = time.asctime(time.localtime(time.time()))
		print(localtime)
		sys.stdout.close()
main()


import sys
try:
	sys.stdin = open('inputf.in', 'r')
	sys.stdout = open('outputf.in', 'w')
except:
	pass
import math
import sys
from math import sqrt
from collections import defaultdict
from collections import Counter
import string

def ii():
	return int(sys.stdin.readline().strip())

def si():
	return sys.stdin.readline().strip()

def li():
	return list(map(int, sys.stdin.readline().strip().split()))

def mi():
	return map(int, sys.stdin.readline().strip().split())

def dparr(m, n):
	return [[0] * n for i in range(m)]

def check(a, b):
	if a % b == 0:
		return 0
	else:
		return 1
t = ii()
for _ in range(t):
	(A, B, n) = mi()
	ai = li()
	bi = li()
	i = 0
	mons = []
	for i in range(n):
		mons.append([ai[i], bi[i]])
	mons.sort(key=lambda x: check(x[1], A) * x[0])
	i = 0
	while i < n and B > 0:
		f = mons[i][1] // A
		mons[i][1] = mons[i][1] % A
		B -= f * mons[i][0]
		i += 1
	i = 0
	while i < n and B > 0:
		if mons[i][1] > 0 and B > 0:
			mons[i][1] = 0
			B -= mons[i][0]
		i += 1
	ans = True
	for i in mons:
		if i[1] > 0:
			ans = False
	if ans:
		print('YES')
	else:
		print('NO')


from sys import *
from math import *
from bisect import bisect_left
input = lambda : stdin.readline()
int_arr = lambda : list(map(int, stdin.readline().strip().split()))
str_arr = lambda : list(map(str, stdin.readline().split()))
get_str = lambda : map(str, stdin.readline().strip().split())
get_int = lambda : map(int, stdin.readline().strip().split())
get_float = lambda : map(float, stdin.readline().strip().split())
mod = 1000000007
setrecursionlimit(1000)
for _ in range(int(input())):
	(A, B, N) = get_int()
	power = int_arr()
	health = int_arr()
	val = 0
	for i in range(N):
		val += ceil(health[i] / A) * power[i]
	if val - max(power) < B:
		print('YES')
	else:
		print('NO')


def celdelj(x, y):
	if x % y == 0:
		return x / y
	else:
		return x // y + 1

def mozeli(a, b, niza, nizb, n):
	i = 0
	maks = 0
	while i < n:
		b -= celdelj(nizb[i], a) * niza[i]
		if niza[i] > maks:
			maks = niza[i]
		i += 1
	if -maks < b:
		return 'YES'
	else:
		return 'NO'
n = int(input())
while n > 0:
	lista = input().split(' ')
	a = int(lista[0])
	b = int(lista[1])
	n1 = int(lista[2])
	aniz = input().split(' ')
	aniz = [int(i) for i in aniz]
	bniz = input().split(' ')
	bniz = [int(i) for i in bniz]
	print(mozeli(a, b, aniz, bniz, n1))
	n -= 1


import operator
import sys
inf = sys.stdin
input = inf.readline

def read_one_int():
	return int(input().rstrip('\n'))

def read_list_of_ints():
	res = [int(val) for val in input().rstrip('\n').split(' ')]
	return res

def check_seq(A, B, n, m_power, m_health):
	res_map = []
	for i in range(n):
		fights = m_health[i] // A
		if m_health[i] % A:
			fights += 1
		res_map.append((i, m_power[i], fights))
	res_map.sort(key=operator.itemgetter(1, 2))
	for i in range(n):
		(ind, _, _) = res_map[i]
		fights = m_health[ind] // A
		if m_health[ind] % A:
			fights += 1
		B -= m_power[ind] * fights
		if B <= 0 and i == n - 1 and (B + m_power[ind] > 0):
			return 'YES'
		elif B <= 0:
			return 'NO'
	return 'YES'

def main():
	samples = read_one_int()
	res = []
	for _ in range(samples):
		(A, B, n) = read_list_of_ints()
		m_power = read_list_of_ints()
		m_health = read_list_of_ints()
		cur_res = check_seq(A, B, n, m_power, m_health)
		res.append(cur_res)
	print('\n'.join(res))
main()


import time, math as mt, bisect as bs, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
from collections import defaultdict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def readTree(n, e):
	adj = [set() for i in range(n + 1)]
	for i in range(e):
		(u1, u2) = IP()
		adj[u1].add(u2)
	return adj

def sieve():
	li = [True] * (10 ** 3 + 5)
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	(prime, cur) = ([0] * 200, 0)
	for i in range(10 ** 3 + 5):
		if li[i] == True:
			prime[cur] = i
			cur += 1
	return prime

def SPF():
	mx = 10 ** 6 + 1
	spf[1] = 1
	for i in range(2, mx):
		if spf[i] == 1000000000.0:
			spf[i] = i
			for j in range(i * i, mx, i):
				if i < spf[j]:
					spf[j] = i
	return

def prime(n, d):
	prm = set()
	while n != 1:
		prm.add(spf[n])
		n = n // spf[n]
	for ele in prm:
		d[ele] = d.get(ele, 0) + 1
	return
mod = 998244353
inf = 10000000000000000

def solve():
	(ah, bh, n) = L()
	a = L()
	b = L()
	ab = []
	for i in range(n):
		(ac, bc) = (a[i], b[i])
		fight = bc // ah
		if bc % ah:
			fight += 1
		ab.append([ac, bc, fight * ac])
	ab.sort(key=lambda x: x[0])
	for i in range(n):
		(ac, bc) = (ab[i][0], ab[i][1])
		fight = bc // ah
		if bc % ah:
			fight += 1
		if fight * ac <= bh:
			bh -= fight * ac
		elif (fight - 1) * ac < bh:
			bh -= fight * ac
		else:
			print('NO')
			return
		if i != n - 1 and bh <= 0:
			print('NO')
			return
		if i == n - 1:
			print('YES')
			return
	return
t = II()
for i in range(t):
	solve()


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
import threading
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class SegmentTree:

	def __init__(self, data, default=-10 ** 6, func=lambda a, b: max(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree1:

	def __init__(self, data, default=10 ** 6, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
MOD = 10 ** 9 + 7

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
mod = 10 ** 9 + 7
omod = 998244353
prime = [True for i in range(200001)]
pp = [0] * 200001

def SieveOfEratosthenes(n=200000):
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
for _ in range(int(input())):
	(A, B, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = []
	ch = 1
	for i in range(n):
		c.append((a[i], b[i]))
	c.sort()
	h = 0
	for i in range(n):
		t = math.ceil(c[i][1] / A)
		h += t * c[i][0]
	if B - h > -c[-1][0]:
		print('YES')
	else:
		print('NO')


from collections import Counter, deque, defaultdict
from math import *
from bisect import bisect_right
MOD = 1000000007

def solve():
	(a, b, n) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	l = list(zip(l1, l2))
	l.sort()
	cur = 0
	while b > 0 and cur < n - 1:
		x = ceil(l[cur][1] / a)
		b -= l[cur][0] * x
		if b <= 0:
			print('NO')
			return
		cur += 1
	attack = l[n - 1][0]
	health = l[n - 1][1]
	x = ceil(health / a)
	b -= attack * x
	if b > 0:
		print('YES')
		return
	b += attack
	if b > 0:
		print('YES')
		return
	print('NO')
t = int(input())
for num in range(t):
	solve()


import math
t = int(input())
f = []
for _ in range(t):
	(A, B, n) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	term = 0
	for j in range(0, n):
		q = math.ceil(b[j] / A)
		t = q * a[j]
		term += t
	counter = 0
	while counter < n:
		if counter != n - 1:
			if B - term + a[counter] > 0:
				f.append('YES')
				break
			else:
				pass
		elif B - term + a[counter] > 0:
			f.append('YES')
			break
		else:
			f.append('NO')
			break
		counter += 1
for k in f:
	print(k)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	am = list(map(int, input().split()))
	hm = list(map(int, input().split()))
	l = []
	for i in range(n):
		l.append([am[i], hm[i]])
	l.sort()
	ans = 0
	for i in range(n):
		t = (l[i][1] + a - 1) // a
		ans += l[i][0] * t
		if i == n - 1:
			ans2 = ans - l[i][0]
	if ans2 <= b:
		print('YES')
	else:
		print('NO')


from math import *

def solve():
	(attack, health, n) = map(int, input().split())
	bd_att = list(map(int, input().split()))
	bd_hlt = list(map(int, input().split()))
	for i in range(n):
		mine = ceil(bd_hlt[i] / attack)
		health -= mine * bd_att[i]
	if health + max(bd_att) > 0:
		return 'YES'
	return 'NO'
t = int(input())
while t != 0:
	res = solve()
	print(res)
	t -= 1


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for t in range(int(input())):
	(a, b, n) = map(int, input().split())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	l3 = []
	for i in range(n):
		l3.append([l1[i], l2[i]])
	l3.sort()
	ans = 'YES'
	for i in range(n - 1):
		x = (l3[i][1] + a - 1) // a
		b -= x * l3[i][0]
		if b < 1:
			ans = 'NO'
			break
	x = l3[-1][1] // a
	y = l3[-1][1] % a
	if x * l3[-1][0] >= b and y or ((x - 1) * l3[-1][0] > b and (not y)):
		ans = 'NO'
	print(ans)


t = int(input())
ans = []
for j in range(t):
	(A, B, n) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	s = sum((a[i] * ((b[i] + A - 1) // A) for i in range(n)))
	look = True
	for i in range(n):
		h = B - s + a[i]
		if h > 0:
			look = False
			break
	ans.append('NO' if look else 'YES')
print('\n'.join(ans))


import math

def all_less_than_zeros(b):
	for i in b:
		if i[1] > 0:
			return False
	return True

def main_function():
	output_list = []
	for i in range(int(input())):
		(A, B, n) = [int(i) for i in input().split(' ')]
		monsters_a = [int(i) for i in input().split(' ')]
		monsters_b = [int(i) for i in input().split(' ')]
		monsters = []
		for i in range(len(monsters_a)):
			monsters.append([monsters_a[i], monsters_b[i]])
		monsters = sorted(monsters, key=lambda x: x[0])
		while True:
			if B <= 0 and all_less_than_zeros(monsters):
				output_list.append('YES')
				break
			elif B <= 0 and (not all_less_than_zeros(monsters)):
				output_list.append('NO')
				break
			elif B > 0 and all_less_than_zeros(monsters):
				output_list.append('YES')
				break
			for i in range(len(monsters)):
				if B < 0:
					break
				if monsters[i][1] > 0:
					k = min(int(math.ceil(monsters[i][1] / A)), int(math.ceil(B / monsters[i][0])))
					monsters[i][1] -= A * k
					B -= monsters[i][0] * k
	return '\n'.join(output_list)
print(main_function())


from io import BytesIO, IOBase
import sys, os
inpl = lambda : list(map(int, input().split()))
inpii = lambda : map(int, input().split())
inpi = lambda : int(input())
inp = lambda : input()
(rev, ra, l) = (reversed, range, len)
P = print
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
import sys, math
test = inpi()
while test:
	(a, b, n) = inpii()
	li1 = inpl()
	li2 = inpl()
	idx = li1.index(max(li1))
	li1.append(li1.pop(idx))
	li2.append(li2.pop(idx))
	i = 0
	tr = True
	while b > 0 and i < n:
		fi = math.ceil(li2[i] / a)
		if i == n - 1:
			if b > (fi - 1) * li1[i]:
				i += 1
				continue
			else:
				b = 0
				tr = False
				break
		elif b < fi * li1[i]:
			b = 0
			tr = False
			break
		else:
			b -= fi * li1[i]
		i += 1
	if b > 0 or (i >= n and tr):
		print('Yes')
	else:
		print('No')
	test -= 1


from math import ceil

def answer():
	check = h
	for i in range(n):
		check -= ceil(b[i] / p) * a[i]
	check += max(a)
	if check >= 0:
		return 'YES'
	else:
		return 'NO'
for T in range(int(input())):
	(p, h, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	print(answer())


from sys import stdin
from math import ceil
t = int(stdin.readline())
for _ in range(t):
	(A, B, n) = map(int, stdin.readline().split())
	a = list(map(int, stdin.readline().split()))
	b = list(map(int, stdin.readline().split()))
	idx = a.index(max(a))
	for i in range(n):
		B -= ceil(b[i] / A) * a[i]
	if B + a[idx] > 0:
		print('YES')
	else:
		print('NO')


from math import ceil
t = int(input())
for _ in range(t):
	(A, B, n) = tuple(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	for i in range(n):
		B -= ceil(b[i] / A) * a[i]
	won = False
	for i in range(n):
		if B + a[i] > 0:
			won = True
			break
	if won:
		print('YES')
	else:
		print('NO')


import sys
ints = (int(x) for x in sys.stdin.read().split())
sys.setrecursionlimit(3000)

def main():
	ntc = next(ints)
	for tc in range(1, ntc + 1):
		(A, B, n) = (next(ints) for i in range(3))
		a = [next(ints) for i in range(n)]
		b = [next(ints) for i in range(n)]
		c = [a * ((b + A - 1) // A) for (a, b) in zip(a, b)]
		life = B - sum(c)
		ans = life >= 0 or life > -max(a)
		print('YES' if ans else 'NO')
	return
main()


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(A, B, n) = map(int, input().split())
	total_damage = 0
	max_damage = 0
	a = [int(item) for item in input().split()]
	b = [int(item) for item in input().split()]
	for (aa, bb) in zip(a, b):
		max_damage = max(max_damage, aa)
		total_damage += (bb + (A - 1)) // A * aa
	if total_damage - max_damage > B:
		print('NO')
	else:
		print('YES')


x = int(input())
for i in range(x):
	(A, B, n) = input().split()
	A = int(A)
	B = int(B)
	a = [int(a) for a in input().split()]
	b = [int(b) for b in input().split()]
	dmg = 0
	for j in range(len(b)):
		num = (b[j] + A - 1) // A
		dmg += num * a[j]
	if B - dmg + max(a) > 0:
		print('YES')
	else:
		print('NO')


import math
for t in range(int(input())):
	(a, b, n) = map(int, input().split())
	attack = list(map(int, input().split()))
	health = list(map(int, input().split()))
	val = []
	for i in range(n):
		val += [[attack[i], health[i]]]
	val.sort()
	poss = True
	for i in range(n):
		times = math.ceil(val[i][1] / a)
		if i == n - 1:
			if b - (times - 1) * val[i][0] > 0:
				b -= times * val[i][0]
				continue
			else:
				poss = False
				continue
		b -= times * val[i][0]
		if b <= 0:
			poss = False
	if poss:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, n) = [int(x) for x in input().split()]
	As = [int(x) for x in input().split()]
	Bs = [int(x) for x in input().split()]
	final = True
	for i in range(n):
		if b <= 0:
			final = False
		k = Bs[i] // a + (1 if Bs[i] % a != 0 else 0)
		if k * As[i] >= b + As[i]:
			final = False
		b -= k * As[i]
	if b + max(As) > 0:
		final = True
	print('YES' if final else 'NO')


import math
t = int(input())
for _ in range(t):
	h = [int(x) for x in input().split()]
	m_a = [int(x) for x in input().split()]
	m_h = [int(x) for x in input().split()]
	for i in range(h[2]):
		atks = math.ceil(m_h[i] / h[0])
		h[1] -= m_a[i] * atks
	if h[1] + max(m_a) > 0:
		print('YES')
	else:
		print('NO')


import sys
import math
import heapq
import bisect
from collections import Counter
from collections import defaultdict
from io import BytesIO, IOBase
import string

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None
		self.BUFSIZE = 8192

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def get_int():
	return int(input())

def get_ints():
	return list(map(int, input().split(' ')))

def get_int_grid(n):
	return [get_ints() for _ in range(n)]

def get_str():
	return input().split(' ')

def yes_no(b):
	if b:
		return 'YES'
	else:
		return 'NO'

def prefix_sums(a):
	p = [0]
	for x in a:
		p.append(p[-1] + x)
	return p

def solve_a():
	s = input().strip()
	n = len(s)
	r = ''
	for i in range(n):
		if i % 2 == 0:
			if s[i] == 'a':
				r += 'b'
			else:
				r += 'a'
		elif s[i] == 'z':
			r += 'y'
		else:
			r += 'z'
	return r

def solve_b():
	(A, B, n) = get_ints()
	a = get_ints()
	b = get_ints()
	monsters = [(x, y) for (x, y) in zip(a, b)]
	monsters.sort()
	for m in monsters[:-1]:
		B -= m[0] * math.ceil(m[1] / A)
		if B <= 0:
			return 'NO'
	B -= monsters[-1][0] * (math.ceil(monsters[-1][1] / A) - 1)
	return yes_no(B > 0)
t = int(input())
for _ in range(t):
	print(solve_b())


for _ in range(int(input())):
	(A, B, n) = map(int, input().split())
	a = [int(i) for i in input().split()]
	b = [int(i) for i in input().split()]
	s = 0
	for i in range(n):
		s += (b[i] + A - 1) // A * a[i]
	print('YES' if s - B < max(a) else 'NO')


import sys
input = lambda : sys.stdin.readline().strip('\r\n')
sa = lambda : input()
sb = lambda : int(input())
sc = lambda : input().split()
sd = lambda : list(map(int, input().split()))
se = lambda : float(input())
sf = lambda : list(input())
flsh = lambda : sys.stdout.flush()
mod = 10 ** 9 + 7

def hnbhai():
	(A, B, n) = sd()
	a = sd()
	b = sd()
	ans = []
	for i in range(n):
		ans.append([a[i], b[i]])
	ans.sort()
	for i in range(n):
		op = -(-ans[i][1] // A)
		B -= op * ans[i][0]
		if i != n - 1 and B <= 0 or (i == n - 1 and B <= -ans[i][0]):
			print('NO')
			return
	print('YES')
for _ in range(sb()):
	hnbhai()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(A, B, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	print('YNEOS'[sum(((x + A - 1) // A * y for (x, y) in zip(b, a))) - B >= max(a)::2])


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	s = list(map(int, input().split()))
	z = list(map(int, input().split()))
	for i in range(n):
		if z[i] % a > 0:
			b = b - (z[i] // a + 1) * s[i]
		else:
			b = b - z[i] // a * s[i]
	if b + max(s) > 0:
		print('YES')
	else:
		print('NO')


from sys import stdin
input = stdin.buffer.readline
import math
t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	l = [int(x) for x in input().split()]
	health = [int(x) for x in input().split()]
	att = []
	for i in range(n):
		att.append((l[i], i))
	att.sort()
	flag = False
	for i in range(n):
		x = math.ceil(health[att[i][1]] / a)
		y = math.ceil(b / att[i][0])
		if x > y:
			flag = True
			break
		b = b - x * att[i][0]
		if b <= 0 and i < n - 1:
			flag = True
			break
	if flag:
		print('NO')
	else:
		print('YES')


import math
t = int(input().strip())
for _ in range(t):
	(a, b, n) = map(int, input().strip().split())
	en_a = [int(i) for i in input().strip().split()]
	en_b = [int(i) for i in input().strip().split()]
	en_max_a = 0
	num = 0
	for i in range(n):
		num += en_a[i] * math.ceil(en_b[i] / a)
		en_max_a = max(en_max_a, en_a[i])
	if num - en_max_a >= b:
		print('NO')
		continue
	print('YES')


import math

def main():
	t = int(input())
	ans = []
	for _ in range(t):
		(hero_dmg, hero_hp, n) = map(int, input().split())
		dmg = list(map(int, input().split()))
		hp = list(map(int, input().split()))
		total_dmg = 0
		for i in range(len(dmg)):
			total_dmg += dmg[i] * math.ceil(hp[i] / hero_dmg)
		max_hp = -1 * 10 ** 9
		for i in range(len(dmg)):
			max_hp = max(hero_hp - total_dmg + dmg[i], max_hp)
		if max_hp <= 0:
			ans.append('NO')
		else:
			ans.append('YES')
	print('\n'.join(ans))
main()


inn = lambda : int(input())
inm = lambda : map(int, input().split())
ins = lambda : str(input())
ina = lambda : list(map(int, input().split()))

def solve():
	(A, B, n) = inm()
	a = ina()
	b = ina()
	total = 0
	prev = 0
	c = []
	for (i, v) in enumerate(b):
		k = (v + A - 1) // A
		total += a[i] * k
		c.append(k)
	if total <= B:
		print('YES')
		return
	for (i, v) in enumerate(a):
		k = c[i]
		prev = total - a[i]
		if prev < B:
			print('YES')
			return
	print('NO')

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


for i in range(int(input())):
	(A, B, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	for (x, y) in sorted(zip(a, b)):
		B += -y // A * x
	print('YNEOS'[B <= -x::2])


from sys import stdin, stdout
import math
import heapq
import collections
input = stdin.readline

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputstrings():
	return [x for x in input().split()]

def inputstringnum():
	return [ord(x) - ord('a') for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	(A, B, n) = inputnums()
	a = inputlist()
	b = inputlist()
	for i in range(n):
		B -= a[i] * math.ceil(b[i] / A)
	if B + max(a) > 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(A, B, n) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	for (x, y) in sorted(zip(a, b)):
		B = B + -y // A * x
	if B <= -x:
		print('NO')
	else:
		print('YES')


from sys import stdin
_input = stdin.readline
(_range, _int, _list) = (range, int, list)

def solution():
	for _ in _range(_int(_input())):
		(a, b, n) = [_int(i) for i in _input().split()]
		hit = [_int(i) for i in _input().split()]
		hp = [_int(i) for i in _input().split()]
		index = _list(_range(n))
		index.sort(key=lambda x: hit[x])
		for i in _range(n):
			atack_count = hp[index[i]] // a if hp[index[i]] % a == 0 else hp[index[i]] // a + 1
			b -= atack_count * hit[index[i]]
			if i == n - 1 and b + hit[index[i]] > 0:
				b = 1
		if b > 0:
			print('YES')
		else:
			print('NO')
solution()