#include <bits/stdc++.h>
using namespace std;
void func() {
  long long int a, b, c, d;
  cin >> a >> b >> c >> d;
  long long int stock = a;
  map<long long int, int> m;
  for (;;) {
    if (stock > c) {
      stock = stock - (int)((stock - c) / b) * b;
      if (stock == c) stock += d;
    }
    if (stock - b < 0) {
      cout << "No" << endl;
      return;
    } else {
      stock = stock - b + d;
      if (m.count(stock) != 0) {
        cout << "Yes" << endl;
        return;
      } else {
        m[stock] = 1;
      }
    }
  }
}
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) func();
  return 0;
}
