#include <bits/stdc++.h>
using namespace std;
int T;
vector<signed long long> A, B, C, D;
int gcd(signed long long m, signed long long n) {
  if ((0 == m) || (0 == n)) return 0;
  while (m != n) {
    if (m > n)
      m = m - n;
    else
      n = n - m;
  }
  return m;
}
void solve() {
  signed long long i, j;
  string s;
  bool exit = false;
  cin >> T;
  for (i = 0; i < (T); i++) {
    signed long long input;
    cin >> input;
    A.push_back(input);
    cin >> input;
    B.push_back(input);
    cin >> input;
    C.push_back(input);
    cin >> input;
    D.push_back(input);
  }
  vector<string> ret;
  for (i = 0; i < (T); i++) {
    if (A[i] - B[i] < 0 || D[i] - B[i] < 0) {
      ret.push_back("No");
      continue;
    }
    signed long long x = A[i] - B[i];
    signed long long m = D[i] - B[i];
    signed long long y = B[i];
    if (m == 0) {
      ret.push_back("Yes");
      continue;
    }
    x %= m;
    y %= m;
    signed long long gcdMod = gcd(m, y);
    for (j = 0; j < (m); j++) {
      bool cond;
      if (gcdMod == 0) {
        cond = (C[i] + j + 1 - B[i] - x + m) % m == 0;
      } else {
        cond = ((C[i] + j + 1 - B[i] - x + m) % m) % gcdMod == 0;
      }
      if (cond) {
        if (C[i] + j + 1 - B[i] < 0) {
          ret.push_back("No");
          break;
        } else {
          ret.push_back("Yes");
          break;
        }
      }
    }
  }
  for (auto& s : ret) cout << s << endl;
}
int main(int argc, char** argv) {
  string s;
  int i;
  if (argc == 1) ios::sync_with_stdio(false), cin.tie(0);
  for (i = 0; i < (argc - 1); i++) s += argv[i + 1], s += '\n';
  for (i = 0; i < (s.size()); i++) ungetc(s[s.size() - 1 - i], stdin);
  cout.tie(0);
  solve();
  return 0;
}
