#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int32_t main(){
IOS;
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
    int t;
    cin>>t;
    while (t--){
        int A,B,n;
        cin>>A>>B>>n;
        int power[n];
        int health[n];
        for (int i=0;i<n;i++){
            cin>>power[i];
        }
        for (int i=0;i<n;i++){
            cin>>health[i];
        }
        vector<pair<int,int>> m;
        for (int i=0;i<n;i++){
            m.push_back(make_pair(power[i],health[i]));
        }
        sort(m.begin(),m.end());
        // for (int i=0;i<n;i++){
        //     cout<<m[i].second<<endl;
        // }
        int monster = 0;
        int healthMons;
        while (B >= 1 && monster <n){
            int fights = (m[monster].second+(A-1))/A;
            int damageByMons = fights * m[monster].first;
            if (monster == (n-1)){
                healthMons = m[monster].second;
                while (B >= 1 && healthMons >= 1){
                    healthMons = healthMons - A;
                    B = B - m[monster].first;
                }
            }
            else {
                B = B - damageByMons;
            }
            monster++;
        }
        if (monster == n){
            if (healthMons < 1){
                cout<<"YES"<<endl;
            }
            else {
                cout<<"NO"<<endl;
            }
        }
        else {
            cout<<"NO"<<endl;
        }
    }
}