#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
template <class T>
T gcd(T a, T b) {
  return ((b == 0) ? a : gcd(b, a % b));
}
void solve() {
  long long a, b, c, d;
  cin >> a >> b >> c >> d;
  map<int, int> vis;
  long long cur = a;
  int tim = 0;
  while (true) {
    tim++;
    long long l = 1, r = 1e18;
    while (l < r) {
      long long mid = (l + r) / 2;
      if ((cur - (b * mid)) <= c)
        r = mid;
      else
        l = mid + 1;
    }
    if ((cur - (b * l)) < 0) {
      cout << "No" << endl;
      return;
    }
    cur -= (b * l);
    if (vis[cur]) {
      cout << "Yes" << endl;
      return;
    }
    vis[cur]++;
    cur += d;
    if (tim >= 10000) {
      cout << "Yes" << endl;
      return;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
