#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <cmath>
#include <queue>
#define eps 1e-7
#define M 21
#define N 100005
#define SZ 200000002
#define eps 1e-7
using namespace std;
typedef long long ll;
const int inf = 1000000000;
ll mod = 1000000007LL;
ll mod2 = 998244353LL;
int t;
int A,B,n;
int a[N], b[N];
ll c[N];
int main() {
	cin>>t;
	for (int cas=1; cas<=t; ++cas) {
		scanf("%d%d%d", &A, &B, &n);
		for (int i = 1; i <= n; ++i) {
			scanf("%d", &a[i]);
		}
		for (int i = 1; i <= n; ++i) {
			scanf("%d", &b[i]);
		}
		ll tot=0LL;
		for (int i = 1; i <= n; ++i) {
			int cnt = (b[i] + A-1) / A;
			c[i] = (ll)a[i] * (ll)cnt;
			tot += c[i];
		}
		bool ok = false;
		for (int i = 1; i <= n; ++i) {
			int cnt = (b[i] + A-1) / A;
			cnt--;
			ll tot2 = tot - c[i];
			if (tot2 + (ll)a[i] * (ll)cnt < B) {
				ok=true;
				break;
			}
		}
		if (ok) puts("YES");
		else puts("NO");
	}
  return 0;
}