#include<bits/stdc++.h>

#define int long long
#define pb push_back
#define um unordered_map
#define us unordered_set
#define mod 1000000007
#define MAXN 100015
#define all(x) x.begin(),x.end()

using namespace std;

void bruh(){
	int A,B,N;
	cin>>A>>B>>N;
	vector<int> a(N);
	vector<pair<int,int>> v(N);
	for(int i=0;i<N;i++) cin>>a[i];
	for(int i=0;i<N;i++){
		int h;cin>>h;
		v[i].first = a[i];
		v[i].second = h;
	}
	sort(all(v));
	bool dead = false;
	for(int i=0;i<N;i++){
		int x = ceil((double)v[i].second/A);
		int y = ceil((double)B/v[i].first);
		x = min(x,y);
		B -= (x*v[i].first);
		v[i].second -= (x*A);
		if(B <= 0 && i != N-1){
			dead = true;
			break;
		}
		if(v[i].second > 0){
			dead = true;
			break;
		}
	}
	cout << (!dead ? "YES" : "NO") << endl;
}

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	cin>>t;
	while(t--){
		bruh();
	}
	return 0;
}
