#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
    ll t,a,b,n,i;
    cin>>t;
    while(t--) {
        cin>>a>>b>>n;
        vector<pair<ll,ll>>v(n);
        for(i=0; i<n; i++)
            cin>>v[i].first;
        for(i=0; i<n; i++)
            cin>>v[i].second;
        sort(v.begin(), v.end());
        ll f=0,a1,a2,a3;
        for(i=0; i<n; i++)  {
            if(b<=0){
                f=1;
                break;
            }
            else {
                a1 = v[i].second/a;
                if(v[i].second%a!=0) a1++;
                a2 = b/v[i].first;
                if(b%v[i].first!=0) a2++;
                a3 = min(a2,a1);
                b-=(a3*v[i].first);
                v[i].second-=(a3*a);
            }
        }
        if(f==1)
            cout<<"NO\n";
        else {
            if(v[n-1].second>0)
                cout<<"NO\n";
            else
                cout<<"YES\n";
        }
    }
}