#include <bits/stdc++.h>
using namespace std;
int n;
long long a, b, c, d;
set<long long> rest;
bool slove() {
  long long t = a;
  while (1) {
    if (rest.find(t) != rest.end()) return true;
    rest.insert(t);
    if (t < b) {
      return false;
    }
    t -= b;
    long long k = (t - c - b) / b;
    if (k > 0) t -= k * b;
    if (t <= c) {
      t += d;
    }
  }
  return false;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    rest.clear();
    cin >> a >> b >> c >> d;
    if (slove()) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}
