#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <map>
#include <set>
//good
#define ll long long
using namespace std;

void solve() {
    int A, B, n;
    cin >> A >> B >> n;
    vector<pair<int, int>> 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) {
        ll count = a[i].second / A;
        if (count * a[i].first > B && count > 1) {
            cout << "NO" << endl;
            return;
        }
        B -= count * a[i].first;
        a[i].second -= count * A;
    }

    for (int i = 0; i < n; ++i) {
        if (a[i].second > 0 && B <= 0) {
            cout << "NO" << endl;
            return;
        }
        if (a[i].second > 0)
            B -= a[i].first;
    }
    cout << "YES" << endl;
}

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