#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;


bool find(long int A, long int B, int n, vector<long int> a, vector<long int> b) {
    int64_t damage = 0;
    for(int i = 0; i < n; i++) {
        damage += int64_t(b[i] + A - 1) / A * a[i];
    }
    for(int i = 0; i < n; i++) {
        if(B - (damage - a[i]) > 0)
            return true;
    }
    return false;
}


int main() {
    int t;
    cin>>t;
    while(t--) {
        long int A, B;
        int n;
        cin>>A>>B>>n;
        vector<long int> a(n);
        vector<long int> b(n);
        vector<long int> c(n);
        long int res = 0, mx = 0;
        for(int i = 0; i < n; i++) 
            cin>>a[i];
        for(int i = 0; i < n; i++) {
            cin>>b[i];
        }
        if(find(A, B, n, a, b))
            cout<<"YES"<<"\n";
        else
            cout<<"NO"<<"\n";
    }
    return 0;
}