#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  long long int A[300], B[300], C[300], D[300];
  map<long long int, bool> mp;
  cin >> t;
  for (int i = 0; i < t; i++) {
    scanf("%lld %lld %lld %lld", &A[i], &B[i], &C[i], &D[i]);
  }
  for (int i = 0; i < t; i++) {
    mp.clear();
    long long int a = A[i], b = B[i], c = C[i], d = D[i];
    while (1) {
      long long int tmp = a - c - 1;
      if (tmp < 0) tmp = 0;
      a -= tmp / 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;
}
