#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  long long A, B, C, D;
  long long Atmp;
  bool isYes;
  set<int> numSet;
  cin >> T;
  for (int i = 0; i < T; i++) {
    numSet.clear();
    isYes = false;
    cin >> A >> B >> C >> D;
    Atmp = A;
    numSet.insert(A);
    while (true) {
      if ((Atmp - B) < 0) break;
      Atmp = Atmp % B;
      if (Atmp <= C) {
        Atmp += D;
        if (numSet.find(Atmp) == numSet.end()) {
          numSet.insert(Atmp);
        } else {
          cout << "Yes" << endl;
          isYes = true;
          break;
        }
        if (Atmp == A || Atmp == 0) {
          cout << "Yes" << endl;
          isYes = true;
          break;
        }
      }
    }
    if (isYes == false) cout << "No" << endl;
  }
  return 0;
}
