#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = (ll)1e18;
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-9;
constexpr int dx[4] = {1, 0, -1, 0};
constexpr int dy[4] = {0, 1, 0, -1};
constexpr int dx8[8] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy8[8] = {0, 1, 0, -1, 1, -1, 1, -1};
void p() { std::cout << '\n'; }
template <typename Head, typename... Tail>
void p(Head head, Tail... tail) {
  std::cout << head << (sizeof...(tail) ? " " : "");
  p(tail...);
}
template <typename T>
inline void pv(vector<T>& v) {
  for (ll i = 0, N = v.size(); i < N; i++)
    std::cout << v[i] << " \n"[i == N - 1];
}
template <typename T>
inline T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <typename T>
inline T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <typename T>
inline bool chmax(T& a, T b) {
  return a < b && (a = b, true);
}
template <typename T>
inline bool chmin(T& a, T b) {
  return a > b && (a = b, true);
}
template <typename T>
inline void uniq(vector<T>& v) {
  v.erase(unique(v.begin(), v.end()), v.end());
}
void solve() {
  ll Q;
  cin >> Q;
  vector<bool> ans(Q, false);
  for (ll i = 0, i_length = (Q); i < i_length; ++i) {
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    ll t = (A - C) / B;
    A -= (t - 1) * B;
    t = (D - C) / B;
    D -= (t - 1) * B;
    set<ll> s;
    bool loop = false;
    {};
    ll ringo = A;
    while (ringo >= B) {
      {};
      if (s.find(ringo) == s.end()) {
        s.insert(ringo);
      } else {
        loop = true;
        break;
      }
      ringo -= B;
      if (ringo <= C) ringo += D;
    }
    if (loop) ans[i] = true;
  }
  for (ll i = 0, i_length = (Q); i < i_length; ++i)
    cout << (ans[i] ? "Yes" : "No") << endl;
}
signed main() {
  solve();
  return 0;
}
