#include <bits/stdc++.h>
using namespace std;
bool calc(vector<long long>& abcd) {
  map<long long, int> uni;
  long long a, b, c, d;
  a = abcd[0];
  b = abcd[1];
  c = abcd[2];
  d = abcd[3];
  if (a < b) return false;
  if (b > d) return false;
  if (c >= b) return true;
  long long e;
  a -= c;
  if (a > b) a = a % b;
  d = d % b;
  e = b - c;
  long long counter = 0;
  while (counter < b) {
    if (a < e) return false;
    uni[a] += 1;
    if (uni[a] > 1) {
      return true;
    }
    a += d;
    if (a > b) a -= b;
    ++counter;
  }
  return true;
}
int main(int argc, const char* argv[]) {
  int T;
  cin >> T;
  vector<bool> res;
  for (int i = 0; i < T; ++i) {
    vector<long long> a(4);
    cin >> a[0] >> a[1] >> a[2] >> a[3];
    res.push_back(calc(a));
  }
  for (auto it = res.begin(); it != res.end(); ++it) {
    cout << (*it ? "Yes" : "No") << endl;
  }
  return 0;
}
