#include <bits/stdc++.h>
using namespace std;
int T, a, n, p, h, ans;
int work(long long a, long long n, long long p) {
  long long c = a * n / p;
  if (!c) return max(a, p - a * n);
  if (a * n % p < a * (p / a - 1)) c--;
  return work(a - p % a, c, a);
}
int main() {
  for (scanf("%d", &T); T--;) {
    scanf("%d%d%d%d", &a, &n, &p, &h);
    a %= p;
    ans = (long long)a * n < p ? a : work(a, n, p);
    puts(h < ans ? "NO" : "YES");
  }
  return 0;
}
