#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T& num) {
  num = 0;
  bool f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = 0;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    num = num * 10 + ch - '0';
    ch = getchar();
  }
  num = f ? num : -num;
}
template <class T>
inline void write(T x, char ch) {
  int s[100];
  if (x == 0) {
    putchar('0');
    putchar(ch);
    return;
  }
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  int num = 0;
  while (x) {
    s[num++] = (x % 10);
    x = x / 10;
  }
  for (int i = (num - 1); i >= (0); i--) putchar(s[i] + '0');
  putchar(ch);
}
const double pi = acos(-1);
const double eps = 1e-8;
set<long long> s;
int main() {
  int cas;
  read(cas);
  while (cas--) {
    s.clear();
    long long a, b, c, d;
    read(a);
    read(b);
    read(c);
    read(d);
    long long t = a;
    bool flag = true;
    while (s.count(a) == 0) {
      s.insert(a);
      if (b > a) {
        flag = false;
        break;
      }
      if (a > c && (a - c) % b == 0) {
        a = c + d;
        continue;
      } else {
        if (a > c)
          a = a - min(a / b, ((a - c) / b + 1)) * b;
        else {
          if (a < b) {
            flag = false;
            break;
          } else
            a -= b;
        }
        if (a < c) a += d;
      }
    }
    if (flag)
      puts("Yes");
    else
      puts("No");
  }
}
