#include <bits/stdc++.h>
using namespace std;
using INT = long long;
int calc(int a, int n, int p) {
  int nn = (INT)a * n / p;
  if (nn == 0) return max(a, p - a * n);
  if (p / a * a - a > (INT)a * n % p) nn--;
  return calc(a - p % a, nn, a);
}
int solve() {
  int a, n, p, h;
  scanf("%d %d %d %d", &a, &n, &p, &h);
  a %= p;
  if ((INT)a * n <= p) return a <= h;
  return calc(a, n, p) <= h;
}
int main() {
  int T;
  cin >> T;
  while (T--)
    if (solve())
      puts("YES");
    else
      puts("NO");
}
