#include <bits/stdc++.h>
using namespace std;
double e_time(void) {
  static struct timeval now;
  gettimeofday(&now, NULL);
  return (double)(now.tv_sec + now.tv_usec / 1000000.0);
}
template <class T>
void vp(T& a, int p) {
  for (int i = 0; i < p; i++) cout << a[i] << " ";
  cout << endl;
}
template <class T>
T ceilUp(const T& a, const T& b) {
  return (a + b - 1) / b;
}
const long long mod = 1000000009;
inline long long modadd(long long a, long long b) {
  a %= mod;
  b %= mod;
  return (a + b) % mod;
}
inline long long modsub(long long a, long long b) {
  a %= mod;
  b %= mod;
  a -= b;
  a %= mod;
  if (a < 0) a += mod;
  return a;
}
inline long long modmul(long long a, long long b) {
  a %= mod;
  b %= mod;
  return (a * b) % mod;
}
inline long long modeq(long long a, long long b, long long m) {
  a = (a % m + m) % m;
  b = (b % m + m) % m;
  return a == b;
}
bool solve(long long a, long long b, long long c, long long d) {
  long long cur = a;
  set<long long> S;
  S.insert(cur);
  while (true) {
    long long tmp = ceilUp((cur - c), b);
    if (cur > c) {
      cur = cur - tmp * b;
    } else {
      cur -= b;
    }
    if (cur < 0) break;
    if (cur <= c) cur += d;
    if (S.count(cur)) return true;
    S.insert(cur);
  }
  return cur >= b;
}
int main() {
  int tc;
  long long a, b, c, d;
  cin >> tc;
  while (tc--) {
    cin >> a >> b >> c >> d;
    if (solve(a, b, c, d))
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}
