#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
long long solve(long long a, long long n, long long p) {
  if (a * n < p) return max(a, p - a * n);
  long long step = a * n / p;
  if (a * n % p < a * (p / a - 1)) step--;
  return solve(min(p % a, p - p % a), step, a);
}
int main() {
  int T;
  long long a, n, p, h;
  cin >> T;
  while (T--) {
    cin >> a >> n >> p >> h;
    a %= p;
    if (a * n < p)
      puts(a > h ? "NO" : "YES");
    else
      puts(solve(a, n, p) > h ? "NO" : "YES");
  }
  return 0;
}
