#include <bits/stdc++.h>
int T, N, A, P, H;
int F(long long a, int n, int p) {
  int t = a * n / p;
  if (!t) return a > p - a * n ? a : p - a * n;
  if (a * n % p < a * (p / a - 1)) t--;
  return F(std::min(a - p % a, p % a), t, a);
}
int main() {
  for (scanf("%d", &T); T; T--)
    scanf("%d%d%d%d", &A, &N, &P, &H), A %= P,
        puts((1ll * A * N < P ? A : F(A, N, P)) > H ? "NO" : "YES");
}
