#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout.precision(10);
	int t;
	cin >> t;
	while (t--) {
		ll A, B;
		int n, m = 0;
		cin >> A >> B >> n;
		ll a[n], b[n];
		vector<ll>v;
		for (int i = 0; i < n; i++)
			cin >> a[i];
		for (int i = 0; i < n; i++) {
			cin >> b[i];
			if (b[i] % A) {
				B -= (b[i] / A) * a[i];
			} else {
				B -= ((b[i] / A) - 1L) * a[i];
			}
			v.push_back(a[i]);
		}
		m = int(v.size());
		if (m) {
			sort(v.begin(), v.end());
			for (int i = 0; i < m - 1; i++) {
				B -= v[i];
			}
		}
		if (B > 0) {
			cout << "YES\n";
		} else {
			cout << "NO\n";
		}
	}
	return 0;
}