#include <bits/stdc++.h>
using namespace std;
set<long long> mySet;
bool BuyContinue(long long A, long long B, long long C, long long D) {
  long long A1 = A;
  long long B1 = B;
  long long C1 = C;
  long long D1 = D;
  set<long long>::iterator sit;
  while (true) {
    if (A1 - B1 < 0) {
      return false;
    }
    long long A2 = A1 % B1;
    if (A2 <= C1) {
      A2 += D1;
    }
    sit = mySet.find(A2);
    if (sit != mySet.end()) {
      return true;
    } else {
      mySet.insert(A2);
    }
    A1 = A2;
    if (mySet.size() > 100000) {
      return true;
    }
  }
}
int main(int argc, char* argv[]) {
  long long i, T;
  cin >> T;
  vector<long long> A(T), B(T), C(T), D(T);
  for (i = 0; i < T; i++) {
    cin >> A[i] >> B[i] >> C[i] >> D[i];
  }
  for (i = 0; i < T; i++) {
    if (A[i] < B[i]) {
      cout << "No" << endl;
      continue;
    }
    if (B[i] == 1) {
      cout << "Yes" << endl;
      continue;
    }
    if (BuyContinue(A[i], B[i], C[i], D[i])) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
    mySet.clear();
  }
  return 0;
}
