#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long w = 0, x = 0;
  char c = getchar();
  while (!isdigit(c)) w |= c == '-', c = getchar();
  while (isdigit(c)) x = x * 10 + (c ^ 48), c = getchar();
  return w ? -x : x;
}
namespace star {
long long n, a, p, h;
long long solve(long long a, long long p, long long n) {
  return a * n < p ? max(a, p - a * n)
                   : solve(min(p % a, a - p % a), a,
                           a * n / p - (a * n % p + a < p / a * a));
}
inline void work() {
  a = read(), n = read(), p = read(), h = read(), a %= p;
  puts((a * n < p ? a : solve(a, p, n)) <= h ? "YES" : "NO");
}
}  // namespace star
signed main() {
  long long T = read();
  while (T--) star::work();
  return 0;
}
