#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int main(int argc, char *argv[]) {
  int t;
  cin >> t;
  for (int tt = 0; tt < t; ++tt) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    bool ans = d >= b;
    long long r = a;
    for (int i = 0; i < 10000; ++i) {
      r -= b;
      if (r < 0) {
        ans = false;
        break;
      }
      if (r <= c) {
        r += d;
      }
    }
    if (ans && b > c) {
      r = a;
      if (r > b + c) {
        r = ((r - c) % b) + c;
      }
      if (r >= b) {
        r -= b;
      }
      long long p = d % b;
      if (!p) {
        ans = r <= c;
      } else {
        long long g = gcd(b - r, p);
        long long x = b - g;
        ans = x <= c;
      }
    }
    cout << (ans ? "Yes" : "No") << endl;
  }
  return 0;
}
