#include <bits/stdc++.h>
using namespace std;
inline long long mod(long long n) { return (n % 1000000007); }
long long gcd(long long a, long long b) {
  if (a == 0 || b == 0) return 0;
  if (b == 1)
    return b;
  else
    return gcd(b, a % b);
}
long long query(long long a, long long b, long long c, long long d) {
  long long l = 1, r = (long long)2e18 / b;
  long long qtd = -1;
  while (l <= r) {
    long long m = (l + r) >> 1;
    if (a - b * m <= c) {
      qtd = m;
      r = m - 1;
    } else
      l = m + 1;
  }
  a -= qtd * b;
  if (a >= 0) a += d;
  return a;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    vector<long long> v;
    long long it = 100000;
    v.push_back(a);
    while (it--) {
      v.push_back(query(v.back(), b, c, d));
    }
    bool flag = false;
    set<long long> s;
    for (long long i = 0; i < v.size(); i++) {
      if (s.count(v[i])) flag = true;
      s.insert(v[i]);
    }
    for (long long i = 0; i < v.size(); i++)
      if (v[i] <= 0) flag = false;
    if (flag)
      cout << "Yes" << '\n';
    else
      cout << "No" << '\n';
  }
}
