#include <bits/stdc++.h>
template <typename Elem>
Elem max(Elem a, Elem b) {
  return a > b ? a : b;
}
template <typename Elem>
Elem min(Elem a, Elem b) {
  return a < b ? a : b;
}
long long work(long long a, long long n, long long p) {
  long long c = a * n / p;
  if (c == 0) {
    return max(a, p - a * n);
  }
  if (a * n % p < a * (p / a - 1)) {
    c--;
  }
  return work(min(a - p % a, p % a), c, a);
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    long long a, n, p, h;
    scanf("%lld%lld%lld%lld", &a, &n, &p, &h);
    a %= p;
    long long ans = a * n < p ? a : work(a, n, p);
    if (ans <= h) {
      puts("YES");
    } else {
      puts("NO");
    }
  }
  return 0;
}
