#include <bits/stdc++.h>
using namespace std;
const string YES = "Yes";
const string NO = "No";
void solve() {
  long long A, B, C, D;
  cin >> A >> B >> C >> D;
  A -= B;
  if (A < 0 || D < B) {
    cout << NO << endl;
    return;
  }
  set<long long> S;
  for (;;) {
    S.insert(A);
    long long t = A - ((A - C + B - 1) / B) * B;
    if (t < 0) {
      cout << NO << endl;
      return;
    }
    A = t + D;
    if (S.find(A) != S.end()) {
      cout << YES << endl;
      return;
    }
  }
}
signed main() {
  long long T;
  cin >> T;
  for (long long _ = 0; _ < T; ++_) {
    solve();
  }
  return 0;
}
