#include <bits/stdc++.h>
using namespace std;
long long work(long long a, long long n, long long p) {
  if (a * n < p) return max(a, p - a * n);
  long long aii = a * n / p;
  if (a * n % p < a * (p / a - 1)) aii--;
  return work(min(p % a, a - p % a), aii, a);
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    long long a, n, p, h, yjy;
    scanf("%lld%lld%lld%lld", &a, &n, &p, &h);
    a %= p;
    if (a * n < p)
      yjy = a;
    else
      yjy = work(a, n, p);
    if (yjy > h)
      printf("NO\n");
    else
      printf("YES\n");
  }
}
