#include <bits/stdc++.h>
using namespace std;
template <class U, class T>
void Max(U &first, T second) {
  if (first < second) first = second;
}
template <class U, class T>
void Min(U &first, T second) {
  if (first > second) first = second;
}
template <class T>
void add(int &a, T b) {
  a = (a + b) % 998244353;
}
int pow(int a, int b) {
  cerr << a << " " << b << "\n";
  int ans = 1;
  while (b) {
    if (b & 1) ans = 1LL * ans * a % 998244353;
    a = 1LL * a * a % 998244353;
    b >>= 1;
  }
  return ans;
}
int main() {
  srand(time(NULL));
  int T, ca = 0, m = 0, k, i, j, n, K;
  scanf("%d", &T);
  long long a, b, c, d;
  while (T--) {
    scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
    map<long long, int> g;
    int ok = 1;
    while (a) {
      if (g.count(a)) break;
      g[a] = 1;
      if (a < b) {
        ok = 0;
        break;
      }
      a -= b;
      if (a <= c) {
        a += d;
        continue;
      }
      long long first = (a - c) / b;
      a -= b * first;
      if (a <= c) {
        a += d;
        continue;
      }
    }
    puts(ok ? "Yes" : "No");
  }
}
