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