#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
 
using namespace std;
 
void solve()
{
    int h_power;
    cin >> h_power;
    int h_health;
    cin >> h_health;
    int n_enemies;
    cin >> n_enemies;
 
    vector<long long> e_power;
    e_power.reserve(n_enemies);
    vector<int> e_health;
    e_health.reserve(n_enemies);
    for(int i = 0; i < n_enemies; i++)
    {
        cin >> e_power[i];
    }
    for(int i = 0; i < n_enemies; i++)
    {
        cin >> e_health[i];
    }
 
    
    long long i_dmg = 0;
    for(int i = 0; i < n_enemies; i++)
    {
        long long b = (e_health[i] + h_power - 1) / h_power;
        i_dmg += b * e_power[i];
    }
	for (int i = 0; i < n_enemies; ++i)
		if (h_health - (i_dmg - e_power[i]) > 0)
		{
			cout << "YES" << endl;
			return;
		}
	cout << "NO" << endl;
}
 
int main()
{	
    int t;
    cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}