#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pb push_back
#define inf 1e18
#define nn  "\n"
#define vll vector<long long int>
#define vl vector<long int>
#define ff first
#define ss second






int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    int t;
    cin>>t;

    while(t--)
    {
    	ll int hero_attack,hero_health,n;
    	cin>>hero_attack>>hero_health>>n;

    	vector<pair<ll int,ll int>> v;
    	ll int attack[n];
    	for(int i=0;i<n;i++)
    	{
    		cin>>attack[i];    		
    	}

    	ll int health[n];
    	
    	for(int i=0;i<n;i++)
    	{
    		cin>>health[i];    		
    	}

    	for(int i=0;i<n;i++)
    	{
    		v.pb({attack[i],health[i]});
    	}

    	sort(v.begin(),v.end());
 
        int flag=1;
        for(auto &it:v)
        {	

    	    ll int x,y;
    	    if(hero_health<=0)
    	    {
    	    	flag=0;
    	    	cout<<"NO"<<nn;
    	    	break;
    	    }

    	    if(it.second%hero_attack!=0)
    	    {
    		   x=(it.second/hero_attack)+1;
    	    }
    	    if(it.second%hero_attack==0)
    	    {
    		   x=it.second/hero_attack;
    	    }
    	    if(hero_health%it.first!=0)
    	    {
    		   y=(hero_health/it.first)+1;
    	    }
    	    if(hero_health%it.first==0)
    	    {
    		   y=hero_health/it.first;
    	    }


    	    if(x<=y)
    	    {
    	    	hero_health=hero_health-x*it.first;

    	    }
    	    else
    	    {
    	    	cout<<"NO"<<nn;
    	    	flag=0;
    	    	break;

    	    }



        }

        if(flag==1)
        	cout<<"YES"<<nn;



    	


    }

    return 0;

}  

