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