#include <bits/stdc++.h>
inline int scan() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline void Out(int a) {
  if (a < 0) {
    putchar('-');
    a = -a;
  }
  if (a >= 10) Out(a / 10);
  putchar(a % 10 + '0');
}
using namespace std;
const int maxn = 100005;
unordered_map<long long, long long> M;
int main() {
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    M.clear();
    long long a, b, c, d;
    bool flag = true;
    cin >> a >> b >> c >> d;
    M[a] = 1;
    if (a < b) flag = false;
    if (d < b) flag = false;
    while (flag) {
      long long temp = (a - c) / b;
      if ((a - c) % b != 0) temp++;
      a -= temp * b;
      if (M[a] == 0)
        M[a] = 1;
      else
        break;
      if (a >= 0 && a <= c) {
        a += d;
        if (M[a] == 0)
          M[a] = 1;
        else
          break;
      } else {
        flag = false;
        break;
      }
    }
    if (flag)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}
