#include <bits/stdc++.h>
using namespace std;
map<long long, int> mp;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  for (int test = 1; test <= t; test++) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    bool ok = false;
    while (a >= b) {
      if (mp[a] == test) {
        ok = true;
        break;
      }
      mp[a] = test;
      if (a <= c) {
        a -= b;
        a += d;
      } else {
        long long x = ((a - c) + b - 1LL) / b;
        a -= b * x;
        if (a < 0LL) {
          break;
        }
        a += d;
      }
    }
    if (ok) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}
