#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void chkmin(T &a, T b) {
  if (a > b) a = b;
}
template <class T>
inline void chkmax(T &a, T b) {
  if (a < b) a = b;
}
int solve(int a, int n, int p) {
  int t;
  t = 1LL * a * n / p;
  if (t == 0) return max(a, p - a * n);
  if (1LL * a * n % p < a * (p / a - 1)) t--;
  return solve(min(p % a, a - p % a), t, a);
}
int main() {
  int T, A, N, P, H, diff;
  for (scanf("%d", &T); T--;) {
    scanf("%d%d%d%d", &A, &N, &P, &H);
    A %= P;
    if (1LL * A * N < P)
      diff = A;
    else
      diff = solve(A, N, P);
    if (diff <= H)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
