#include <bits/stdc++.h>
using namespace std;
int main() {
  long T, A, B, C, D;
  cin >> T;
  vector<long> AA(T, 0);
  vector<long> BB(T, 0);
  vector<long> CC(T, 0);
  vector<long> DD(T, 0);
  int count = 0;
  for (long i = 0; i < T; i++) {
    cin >> AA.at(i) >> BB.at(i) >> CC.at(i) >> DD.at(i);
  }
  for (long i = 0; i < T; i++) {
    A = AA.at(i);
    B = BB.at(i);
    C = CC.at(i);
    D = DD.at(i);
    vector<long> amari(B, 0);
    for (long j = 0; j <= B; j++) {
      if (A < B) {
        cout << "No" << endl;
        break;
      }
      A %= B;
      amari.at(A)++;
      if (amari.at(A) == 2) {
        cout << "Yes" << endl;
        break;
      }
      if (A <= C) {
        A += D;
      }
    }
  }
}
