#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long a, b, c, d;
  cin >> a >> b >> c >> d;
  set<long long> ms;
  while (1) {
    if (ms.find(a) != ms.end()) {
      cout << "Yes\n";
      return;
    }
    ms.insert(a);
    long long x = (max(0ll, a - c) + b - 1) / b;
    x = max(1ll, x);
    a -= b * x;
    if (a < 0) {
      cout << "No\n";
      return;
    }
    a += d;
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long t;
  cin >> t;
  while (t--) solve();
}
