#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  long long A[T], B[T], C[T], D[T];
  for (int i = 0; i < T; i++) {
    cin >> A[i] >> B[i] >> C[i] >> D[i];
  }
  for (int i = 0; i < T; i++) {
    map<long long, long long> reco;
    reco[A[i]]++;
    long long Atmp = A[i];
    long long Btmp = B[i];
    long long Ctmp = C[i];
    long long Dtmp = D[i];
    bool loopflg = false;
    for (;;) {
      long long times = (Atmp - Ctmp) / Btmp;
      if ((Atmp - Ctmp) % Btmp != 0) times++;
      long long tmp;
      if (Atmp > Ctmp)
        tmp = Atmp - Btmp * times;
      else
        tmp = Atmp - Btmp;
      if (tmp < 0)
        break;
      else if (tmp <= Ctmp)
        tmp += Dtmp;
      Atmp = tmp;
      if (reco[Atmp] == 1) {
        loopflg = true;
        break;
      } else
        reco[Atmp]++;
    }
    if (loopflg) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}
