#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  long long int a, b, c, d;
  map<long long int, bool> mp;
  cin >> t;
  for (int i = 0; i < t; i++) {
    mp.clear();
    cin >> a >> b >> c >> d;
    while (1) {
      a -= (a - c - 1) / b * b + b;
      if (a < 0) {
        cout << "No" << endl;
        break;
      }
      if (a <= c) a += d;
      if (mp.find(a) != mp.end()) {
        cout << "Yes" << endl;
        break;
      }
      mp[a] = true;
    }
  }
  return 0;
}
