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