#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int tests;
  cin >> tests;
  for (int test = 0; test < tests; test++) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    set<long long> states;
    long long currState = a;
    bool result = true;
    while (true) {
      if (states.count(currState) != 0) break;
      states.insert(currState);
      currState -= b * ((currState - c) / b);
      while (currState > c) currState -= b;
      if (currState < 0) {
        result = false;
        break;
      }
      if (currState <= c) currState += d;
    }
    cout << (result ? "Yes" : "No") << endl;
  }
}
