#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int tt;
  cin >> tt;
  while (tt--) {
    long long int a, b, c, d;
    cin >> a >> b >> c >> d;
    bool ok = true;
    long long int cans = a;
    for (int i = 0; i < 10000 && ok; i++) {
      if (cans > b && cans > c) {
        long long int k = (cans - c + b - 1) / b;
        cans -= k * b;
      } else {
        cans -= b;
      }
      ok &= (cans >= 0);
      if (cans <= c) cans += d;
    }
    cout << (ok ? "Yes\n" : "No\n");
  }
}
