#include <bits/stdc++.h>
using namespace std;
int T;
int a, n, p, h, ans;
int a1, n1, p1;
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d%d%d%d", &a, &n, &p, &h);
    a %= p;
    if ((long long)a * n < p)
      ans = a;
    else {
      while ((long long)a * n > (long long)p) {
        a1 = min(p % a, a - p % a);
        p1 = a;
        n1 = (long long)a * n / p;
        if ((p / a - 1) * a > (long long)a * n % p) n1--;
        a = a1;
        p = p1;
        n = n1;
      }
      ans = max(a, p - a * n);
    }
    if (h < ans)
      printf("NO\n");
    else
      printf("YES\n");
  }
  return 0;
}
