#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(int argc, char *argv[]) {
  int t;
  cin >> t;
  for (int i = 0; i < t; ++i) {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    map<ll, bool> seen;
    ll supply = a;
    while (supply >= b) {
      ll amount = supply <= c ? supply / b : (supply - c) / b;
      supply -= amount * b;
      if (supply >= b) supply -= b;
      if (seen[supply]) {
        supply = b;
        break;
      }
      seen[supply] = true;
      if (supply <= c) supply += d;
    }
    if (supply >= b)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}
