#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")
using namespace std;
mt19937 rnd(time(0));
const long long maxn = 3e5 + 7, mod = 1e9 + 7, inf = 1e18;
const long double eps = 1e-9, pi = acos(-1);
long long t;
long long gcd(long long a, long long b) {
  while (b != 0) {
    long long c = a % b;
    a = b;
    b = c;
  }
  return a;
}
void solve() {
  cin >> t;
  for (long long i = 0; i < t; ++i) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    if (b == 1) {
      cout << "Yes\n";
      continue;
    }
    if (d < b) {
      cout << "No\n";
      continue;
    }
    if (a - b < 0) {
      cout << "No\n";
      continue;
    }
    if (c >= b) {
      cout << "Yes\n";
      continue;
    }
    a %= b;
    c %= b;
    d %= b;
    long long p = gcd(d, b);
    long long l = (c - a + b) + 1;
    long long r = (b - a + b) - 1;
    if (l > r) {
      cout << "Yes\n";
      continue;
    }
    l %= b;
    r %= b;
    if (l > r) {
      cout << "Yes\n";
      continue;
    }
    if (l < 0) {
      if (-p <= r && -p >= l) {
        cout << "No\n";
      } else {
        cout << "Yes\n";
      }
      continue;
    }
    if (((l + p - 1) / p) * p <= r) {
      cout << "No\n";
      continue;
    }
    cout << "Yes\n";
  }
}
signed main() {
  srand(time(0));
  cout.precision(10);
  cout << fixed;
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
