#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  long long a, n, p, h, hi;
  scanf("%d", &t);
  while (t--) {
    scanf("%lld%lld%lld%lld", &a, &n, &p, &h);
    hi = -1;
    a %= p;
    while (a * n >= p) {
      long long k = a * n / p;
      if (p - p % a - a * n % p >= a) k--;
      long long na = min(a - p % a, p % a), np = a;
      hi = p = np;
      a = na;
      n = k;
    }
    puts(h < max(a, hi - n * a) ? "NO" : "YES");
  }
}
