#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &x) {
  x = 0;
  T tmp = 1;
  char c = getchar();
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  if (c == '-') tmp = -1, c = getchar();
  while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + c - '0', c = getchar();
  x *= tmp;
}
long long a, b, c, d;
set<long long> S;
bool Solve(void) {
  if (a < b) return 0;
  S.clear();
  while (true) {
    long long t = (a - c) / b;
    a -= t * b;
    if (S.find(a) != S.end()) return 1;
    S.insert(a);
    if (t && a <= c) {
      a += d;
      if (S.find(a) != S.end()) return 1;
      S.insert(a);
    }
    while (a - c < b) {
      a -= b;
      if (a < 0) return 0;
      if (a <= c) a += d;
      if (S.find(a) != S.end()) return 1;
      S.insert(a);
    }
    if ((int)S.size() >= 200) return 1;
  }
}
int main(void) {
  int cas;
  read(cas);
  while (cas--) {
    read(a), read(b), read(c), read(d);
    if (Solve())
      puts("Yes");
    else
      puts("No");
  }
  return 0;
}
