#include <bits/stdc++.h>
using namespace std;
static const long long INF = 1e18;
static const long long MAX = 101010;
static const long long MOD = 1e9 + 7;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main(void) {
  long long i, j, k;
  long long T;
  cin >> T;
  for (long long _ = 0; _ < T; _++) {
    long long A, B, C, D;
    cin >> A >> B >> C >> D;
    if (A < B) {
      cout << "No"
           << "\n";
      continue;
    }
    if (D < B) {
      cout << "No"
           << "\n";
      continue;
    }
    if (B - 1 <= C) {
      cout << "Yes"
           << "\n";
      continue;
    }
    long long g = gcd(B, D);
    long long l = -INF - 7, r = INF + 7;
    while (l + 1 < r) {
      long long m = (l + r) / 2;
      if (A + m * g > C)
        r = m;
      else
        l = m;
    }
    if (A + r * g < B)
      cout << "No"
           << "\n";
    else
      cout << "Yes"
           << "\n";
  }
}
