#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>

/*          					GOURAB SARKAR					            */

using namespace std;

typedef   long long 				ll;
typedef   long double 				ld;
#define   PI 					3.141592653589793238
#define   dl 					"\n"
#define   mm(a,val)				memset(a,val,sizeof(a))
#define   test  \
          int t;     \
          cin >> t; \
          while (t--)
#define   fast()                        \
          ios_base::sync_with_stdio(false); \
          cin.tie(NULL);                    \
          cout.tie(NULL);

const     int mod = 				1e9+7;
const     int mod1 = 				1e9+9;
const     int mod2 = 				998244353;

// inline void OPEN()
// {
//     #ifdef ONLINE_JUDGE
//         freopen("input.in", "r", stdin);
//         freopen("output.in", "w", stdout);
//     #endif
// }

inline bool comp(const pair<ll, ll> &a, const pair<ll, ll> &b) {
    return (a.first > b.first);
}

inline void solve() {
    fast();
    ll A, B, n;
    cin >> A >> B >> n;
    vector<ll> a(n), b(n);
    for(ll i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for(ll i = 0; i < n; ++i) {
        cin >> b[i];
    }
    vector<pair<ll, ll> > vp;
    for(ll i = 0; i < n; ++i) {
        vp.push_back({a[i], b[i]});
    }
    sort(vp.begin(), vp.end());
    // for(ll i = 0; i < n; ++i) {
    //     cout << vp[i].first << " " << vp[i].second << dl;
    // }
    for(ll i = 0; i < n && B > 0; ++i) {
        ll need = (vp[i].second % A == 0 ? vp[i].second / A : (vp[i].second / A) + 1);
        ll att = (B % vp[i].first == 0 ? B / vp[i].first : (B / vp[i].first) + 1);
        if(need > att) {
            cout << "NO" << dl;
            return;
        }
        else {
            B -= (need * vp[i].first);
            vp[i].second = 0;
        }
    }
    for(ll i = 0; i < n; ++i) {
        if(vp[i].second > 0) {
            cout << "NO" << dl;
            return;
        }
    }
    cout << "YES" << dl;
}

int main() {
    fast();
    // OPEN();
    // solve();
    test {
        solve();
    }

    return 0;
}