#include <bits/stdc++.h>
using namespace std;
void answer() {
  long int a, b, c, d, n;
  cin >> a >> b >> c >> d;
  n = a;
  set<long int> s;
  s.insert(a);
  while (1) {
    if (n - c - 1 >= 0)
      n = n - ((n - c - 1) / b) * b - b;
    else
      n = n - b;
    if (n < 0) {
      cout << "No" << endl;
      break;
    }
    n += d;
    if (s.count(n)) {
      cout << "Yes" << endl;
      break;
    } else {
      s.insert(n);
    }
  }
}
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    answer();
  }
}
