#include <bits/stdc++.h>
using namespace std;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  std::fill((T *)array, (T *)(array + N), val);
}
struct Edge {
  int from, to, s;
};
int main() {
  int t;
  cin >> t;
  for (int i = (0); (t) > i; i++) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    a -= b;
    if (d < b) {
      cout << "No" << endl;
      continue;
    }
    if (a < 0) {
      cout << "No" << endl;
      continue;
    }
    if (a > c) a -= ((a - c - 1) / b) * b;
    if (a <= c) a += d;
    if (d == b) {
      if (a < b) {
        cout << "No" << endl;
        continue;
      } else {
        cout << "Yes" << endl;
        continue;
      }
    }
    set<long long> al;
    double st = time(NULL);
    while (1) {
      if ((time(NULL) - st) / CLOCKS_PER_SEC > 0.005) {
        cout << "Yes" << endl;
        break;
      }
      if (a > c) a -= ((a - c - 1) / b) * b;
      if (a < b) {
        cout << "No" << endl;
        break;
      }
      if (al.find(a) != al.end()) {
        cout << "Yes" << endl;
        break;
      }
      al.insert(a);
      a += ((c + b + 1 - a + d - b - 1) / (d - b)) * (d - b);
      a -= b;
    }
  }
  return 0;
}
