#include <bits/stdc++.h>
using namespace std;
long long a, n, p, h, T;
long long solve(long long a, long long n, long long p) {
  if (a * n < p) return max(a, p - a * n);
  long long z = a * n / p;
  if (a * n % p < p / a * a - a) z--;
  return solve((p + a - 1) / a * a - p, z, a);
}
signed main() {
  scanf("%lld", &T);
  while (T--) {
    scanf("%lld%lld%lld%lld", &a, &n, &p, &h);
    a %= p;
    if (a <= h) {
      puts("YES");
      continue;
    }
    if (a * n <= p) {
      puts(h >= a ? "YES" : "NO");
      continue;
    }
    puts((solve(a, n, p) <= h) ? "YES" : "NO");
  }
  return 0;
}
