#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 200000;
const long long INF = 1001001001;
const long long MOD = 1000000007;
long long N, ans = 0, tmp = 0;
vector<long long> A, B, C, D;
long long gcd(long long a, long long b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
signed main() {
  cin >> N;
  for (long long i = 0; i < N; i++) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    A.push_back(a);
    B.push_back(b);
    C.push_back(c);
    D.push_back(d);
  }
  for (long long i = 0; i < N; i++) {
    cout << "i : " << i + 1 << endl;
    if (A[i] - B[i] >= 0) {
      long long dlt = gcd(B[i], D[i]);
      long long init = (A[i] - B[i]) % dlt;
      if (init < 0) init += dlt;
      long long num = (min(A[i], C[i] + 1) - B[i]) % dlt;
      if (num < 0) num += dlt;
      long long minv = C[i] + 1 - B[i] + init - num;
      if (init - num < 0) minv += dlt;
      if (minv >= 0) {
        cout << "Yes" << endl;
        continue;
      }
    }
    cout << "No" << endl;
  }
  return 0;
}
