#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout<<setprecision(32);

	int t; cin >> t;
	while(t--){
		int A, B, n;
		cin >> A >> B >> n;
		vector<array<ll, 2> > v(n);
		ll mx = 0;
		for(auto &x : v){
			cin >> x[0];
			mx = max(mx, x[0]);
		}
		ll tot = 0;
		for(auto &x : v){
			cin >> x[1];
			ll cnt = (x[1] + A - 1)/A;
			tot += cnt*x[0];
		}
		tot -= mx;
		if(B <= tot)cout << "NO" << '\n';
		else cout << "YES" << '\n';
	}

	return 0;
}