#include<bits/stdc++.h>

#define int long long

using namespace std;

inline int read()
{
    register int x=0,f=1,ch=getchar();
    while(!isdigit(ch))
	{
		if(ch=='-') f=-1;
		ch=getchar();
	}
    while(isdigit(ch)) x=x*10 +ch-'0',ch=getchar();
    return x*f;
}

struct node
{
	int a,b,c;
};

int t;
int A,B;
int n;
node p[100010];
int sum;

signed main()
{
	t=read();
	while(t--)
	{
		A=read();B=read(),n=read();
		sum=0;
		for(signed i=1;i<=n;i++)
		{
			p[i].a=read();
		}
		for(signed i=1;i<=n;i++)
		{
			p[i].b=read();
			p[i].c=((p[i].b-1)/A+1)*p[i].a;
			sum+=p[i].c;
		}
		//printf("%ld\n",sum);
		if(sum<B)
		{
			puts("YES");
			continue;
		}
		for(signed i=1;i<=n;i++)
		{
			int q=B-sum+p[i].c;
			//printf("%ld\n",q);
			if(q<=0)
			{
				if(i==n)
				{
					puts("NO");
				}
				continue;
			}
			p[i].b-=A*(((q-1)/p[i].a)+1);
			if(p[i].b<=0)
			{
				puts("YES");
				break;
			}
			if(i==n)
			{
				puts("NO");
			}
		}
	}
	return 0;
}

