#include <bits/stdc++.h>
using namespace std;
int mu, lam;
bool ok = true;
long long a, b, c, d;
inline long long f(long long x) {
  if (x < b) {
    ok = false;
    return x;
  }
  x %= b;
  if (x <= c) x += d;
  return x;
}
void floyd(long long x0) {
  long long tortoise = f(x0);
  long long hare = f(f(x0));
  if (!ok) return;
  while (hare != tortoise) {
    tortoise = f(tortoise);
    hare = f(f(hare));
    if (!ok) return;
  }
  mu = 0;
  tortoise = x0;
  while (hare != tortoise) {
    tortoise = f(tortoise);
    hare = f(hare);
    ++mu;
    if (!ok) return;
  }
  lam = 1;
  hare = f(tortoise);
  if (!ok) return;
  while (hare != tortoise) {
    hare = f(hare);
    ++lam;
    if (!ok) return;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t, tc = 0;
  cin >> t;
  while (t--) {
    cin >> a >> b >> c >> d;
    ok = true;
    floyd(a);
    cout << (ok ? "Yes" : "No") << "\n";
  }
  return 0;
}
