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