#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
void print() { cout << "\n"; }
template <class T>
void print(const T &x) {
  cout << x << "\n";
}
template <class T, class... Args>
void print(const T &x, const Args &...args) {
  cout << x << " ";
  print(args...);
}
template <class T>
void printVector(const vector<T> &v) {
  for (const T &x : v) {
    cout << x << " ";
  }
  cout << "\n";
}
using ll = long long;
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
void solve() {
  ll A, B, C, D;
  cin >> A >> B >> C >> D;
  ll now = A;
  {
    if (now - B < 0) {
      print("No");
      return;
    }
  }
  set<ll> se;
  while (true) {
    if (se.count(now)) {
      print("Yes");
      return;
    }
    se.insert(now);
    ll k = (now - C) / B - ((now - C) % B == 0);
    now -= max(k, 0LL) * B;
    if (now - B < 0) {
      print("No");
      return;
    }
    now -= B;
    if (now <= C) {
      now += D;
    }
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
