#include <bits/stdc++.h>
using namespace std;
unsigned long long int calc(unsigned long long int a,
                            unsigned long long int b) {
  if (b == 0) return a;
  if (b % a == 0)
    return b;
  else
    return a * ((b / a) + 1);
}
int main() {
  int T;
  cin >> T;
  vector<unsigned long long int> a(T), b(T), c(T), d(T);
  for (int i = 0; i < T; i++) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }
  vector<bool> ans(T);
  for (int i = 0; i < T; i++) {
    if (a[i] < b[i]) {
      ans[i] = false;
      continue;
    }
    unordered_map<unsigned long long int, bool> list;
    unsigned long long int left = a[i];
    while (1) {
      if (left <= c[i]) left += d[i];
      if (left < c[i]) {
        ans[i] = false;
        break;
      }
      if (left < calc(b[i], left - c[i])) {
        ans[i] = false;
        break;
      }
      left -= calc(b[i], left - c[i]);
      if (list.find(left) != list.end()) {
        ans[i] = true;
        break;
      }
      list[left] = true;
    }
  }
  for (int i = 0; i < T; i++) {
    if (ans[i] == true)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}
