
//sridhar bajpai
#include<bits/stdc++.h>
using namespace std;
 
#define int long long int
#define vi vector<int>
#define inf (int)1e18
#define ee '\n'
#define mod 1000000007
#define db(x) cout<<#x<<' '<<x<<endl;
#define float double
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define fr first
#define sc second
#define prmap(p) for(auto k:p) cout<<k.fr<<' '<<k.sc<<endl;
#define prset(x) for(auto it=x.begin();it!=x.end();it++) cout<< *it<<' ';cout<<endl;
#define all(x) x.begin(),x.end()
#define print(v) for(auto i:v) cout<<i<<' ';cout<<endl;
int min (int x,int y) {if(x<y) return x;return y;}
int max(int x,int y) {if(x>y) return x;return y;}
int maxx(int x,int y,int z){ return max(x,max(y,z));}
int isset(int n, int k) {  if ((n >> (k)) & 1) return 1;return 0;}
void yes(){ cout<<"Yes\n"; }
void no(){cout<<"No\n";}

// inline bool is_palindrome(const string &s) { return std::equal(s.begin(), s.end(), s.rbegin());}

//const int ll=11;
//bitset<ll>a;
vector<bool>prime(2e6,true);
void sieve(int n){
for(int i=2;i*i<=n;i++)
{
    if(prime[i]){
        for(int j=i*i;j<=n;j+=i) prime[j]=false;
    }
}

}

//int maxx(int a,int b) {if(a>b) return a;return b;}
/*int nCr(int n, int r)
{   int p = 1, k = 1;
    if (n - r < r)     r = n - r;
  if (r != 0) {
        while (r) {
            p *= n;
            k *= r; long long m = __gcd(p, k); p /= m;k /= m; n--; r--;
        }
    } else p = 1;

    return p;
} */
/*int cp(int a, int b, int m) {  a %= m;int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}*/
/*void update(int ind,int val,int vl,int st,int en)
{
if(st==en ) { a[vl]=val,b[vl]=val;}
else {
    int md=(st+en)/2;
    if(ind>md){ update(ind,val,2*vl+1,md+1,en );}
    else  {update(ind,val,2*vl,st,md ); }
        a[vl]=max(max(a[2*vl],a[2*vl+1]),b[]-b[]) ;
}



}*///level ,valint fac[]
void solve()
{
int athero,hhero,n;
cin>>athero>>hhero>>n;
vector<pair<int,int>>v(n);
for(int i =0;i<n;i++){
    int atm;
    cin>>atm;
    v[i].fr = atm;
}
for(int i=0;i<n;i++){
    int hm;
    cin>>hm;
    v[i].sc =hm;
}
sort(all(v));
bool f= 0;
for(int i =0;i<n-1;i++){
    int noat = (v[i].sc+athero-1)/athero;  
    hhero -= noat*(v[i].fr);
    if(hhero<=0) {f=1;break;}
    
}
if(hhero>0){//ceil(v[].sc\athero)
    int noat = (v[n-1].sc+athero-1)/athero;
    noat--;
    hhero -= noat*v[n-1].fr;
}
//cout<<hhero;
if(hhero>0) cout<<"YES\n";else cout<<"NO\n";

}
signed main()
{
fio;
int t;
cin>>t;
while(t--){
    solve();
}

cerr<< "Time : "<<1000*((double)clock())/(double)CLOCKS_PER_SEC<<"ms\n";
return 0;
}

