#include <bits/stdc++.h>
using namespace std;
long long floor(long long a, long long b) { return (a / b); }
long long ceiling(long long a, long long b) {
  return (a % b == 0) ? (a / b) : (1 + (a / b));
}
bool solve(long long A, long long B, long long C, long long D) {
  if (A < B) return false;
  if (D < B) return false;
  long long cur = A - B;
  set<long long> s;
  int cnt = 10000;
  vector<long long> pos, neg;
  while (cnt--) {
    if (cur < 0) return false;
    if (s.find(cur) != s.end()) return true;
    s.insert(cur);
    if (C - cur <= 0) neg.push_back(C - cur);
    if (C - cur >= 0) pos.push_back(C - cur);
    if (cur <= C) {
      if (D == B) return true;
      cur = cur + (D - B) * (1 + floor(C - cur, D - B));
    } else {
      cur = cur - B * ceiling(cur - C, B);
    }
  }
  for (int i = 1; i < pos.size(); i++) {
    if (pos[i - 1] > pos[i]) return false;
  }
  for (int i = 1; i < neg.size(); i++) {
    if (neg[i - 1] > neg[i]) return false;
  }
  return true;
}
int main(int argc, char const *argv[]) {
  int t;
  cin >> t;
  while (t--) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    if (solve(a, b, c, d))
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}
