#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX, MOD = 1e9 + 7;
int main() {
  int t;
  cin >> t;
  for (int q = 0; q < t; q++) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    set<long long> s;
    long long tmp = a - b;
    string ans = "Yes";
    bool flgpl = 1;
    while (1) {
      if (tmp < 0) {
        ans = "No";
        break;
      }
      if (flgpl) {
        if (tmp <= c) {
          tmp += d;
          if (tmp - b < 0) {
            ans = "No";
            break;
          }
          flgpl = 0;
        } else {
          s.insert(tmp);
          tmp -= tmp / b * b;
          s.insert(tmp);
          if (c < tmp) {
            ans = "No";
            break;
          }
          if (s.find(tmp) != s.end()) {
            break;
          }
          s.insert(tmp);
        }
      } else {
        s.insert(tmp);
        tmp -= b;
        if (tmp < 0) {
          ans = "No";
          break;
        }
        tmp -= tmp / b * b;
        if (c < tmp) {
          ans = "No";
          break;
        }
        if (s.find(tmp) != s.end()) {
          break;
        }
        s.insert(tmp);
        flgpl = 1;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
