#include <bits/stdc++.h>
using namespace std;
int t, n, p, h, a;
int Calc(long long a, int n, int p) {
  int t = a * n / p;
  if (!t) return max(a, p - a * n);
  if (a * n % p < a * (p / a - 1)) t--;
  return Calc(a - p % a, t, a);
}
int main() {
  for (scanf("%d", &t); t; t--) {
    scanf("%d%d%d%d", &a, &n, &p, &h);
    a %= p;
    puts(((long long)a * n < p ? a : Calc(a, n, p)) > h ? "NO" : "YES");
  }
  return 0;
}
