#include <bits/stdc++.h>
int ia, in, ip, ih;
void init() { scanf("%d%d%d%d", &ia, &in, &ip, &ih); }
int f(int a, int n, int p) {
  if ((long long)a * (n - 1) < p) return std::max(a, p - a * (n - 1));
  int k = (long long)a * n % p;
  int num = (long long)a * n / p + (k >= p / a * a);
  return f((a - p % a) % a, num, a);
}
void solve() {
  ++in;
  ia %= ip;
  int u;
  if ((long long)ia * (in - 1) < ip)
    u = ia;
  else
    u = f(ia, in, ip);
  if (u <= ih)
    printf("YES\n");
  else
    printf("NO\n");
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    init();
    solve();
  }
  return 0;
}
