#include <bits/stdc++.h>
using namespace std;
long long T, A, B, C, D;
long long gcd(long long a, long long b) {
  if (a % b)
    return b;
  else
    return (b, a % b);
}
int main() {
  cin >> T;
  for (int i = 0; i < T; i++) {
    cin >> A >> B >> C >> D;
    bool judge = true;
    long long t = A;
    while (true) {
      if (A < B || (C > D) && (A - B) < C) {
        judge = false;
        break;
      }
      if (B == 1) break;
      long long x = (A - C + B - 1) / B;
      if (A - x * B < 0) {
        judge = false;
        break;
      }
      A = A - x * B + D;
      if (A == t) {
        break;
      }
      if ((t - (A - D)) % B == 0 && (A - t) % B == 0) break;
    }
    if (judge)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}
