#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ull unsigned long long
using ll = long long;
#define pb push_back
#define fi first
#define se second




int main()
{

        ios_base::sync_with_stdio(false); 
        cin.tie(NULL);
        cout.tie(NULL);

        
        
        int t;
        cin>>t;
        while(t--)
        {
            ll A,B,n,flag = 0;
            cin>>A>>B>>n;
            vector<pair<ll,ll>> a(n);
            for(int i=0;i<n;i++)
            {
                cin>>a[i].first;
            }
            for(int i=0;i<n;i++)
            {
                cin>>a[i].second;
            }
            sort(a.begin(),a.end());
            for(int i=0;i<n;i++)
            {
                if(B <= 0)
                {
                    flag = 1;
                    break;
                }
                ll k1 = a[i].second/A;
                ll k2 = a[i].second % A; 
                ll k3 = B/a[i].first;
                ll k4 = B % a[i].first;
                if(k2) k1++;
                if(k4) k3++;
                k1 = min(k1,k3);
                B -= k1*a[i].first;
                a[i].second -= k1*A;
            }
            if(flag == 1)
            {
                cout<<"NO"<<endl;
            }
            else if(a[n-1].second > 0)
            {
                cout<<"NO"<<endl;    
            }
            else
            {
                cout<<"YES"<<endl;
            }



        }
        
          
                                                    

}
    