#include <bits/stdc++.h>
using namespace std;
int t, n, a, p, h;
long long max_dist(long long a, long long n, long long p, int flag) {
  if (a * n < p) {
    long long res = a;
    if (flag) res = max(res, p - a * n);
    return res;
  }
  long long sum = a * n / p, tmp = a - p % a;
  long long first = a * (p / a - 1);
  if (first > a * n % p) sum--;
  return max_dist(min(tmp, a - tmp), sum, a, 1);
}
int main() {
  cin >> t;
  while (t--) {
    cin >> a >> n >> p >> h;
    a %= p;
    if (max_dist(a, n, p, 0) > h)
      cout << "NO\n";
    else
      cout << "YES\n";
  }
}
