#include <bits/stdc++.h>
using namespace std;
long long T, a, n, p, h;
long long f(long long a, long long n, long long p) {
  long long tmp = a * n / p;
  if (!tmp) return max(a, p - a * n);
  if (a * n % p < a * (p / a - 1)) --tmp;
  return f(min(a - p % a, p % a), tmp, a);
}
int main() {
  cin >> T;
  while (T--) {
    cin >> a >> n >> p >> h;
    a %= p;
    if (a * n < p)
      cout << (a > h ? "NO" : "YES") << endl;
    else
      cout << (f(a, n, p) > h ? "NO" : "YES") << endl;
  }
}
