#include <bits/stdc++.h>
using namespace std;
signed main(void) {
  long long i, j;
  long long n;
  cin >> n;
  for (i = 0; i < (n); i++) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    map<long long, long long> mp;
    mp[a]++;
    for (j = 0; j < (100); j++) {
      if (a < b) {
        cout << "No" << endl;
        goto END;
      }
      long long k = (a - c) / b;
      if (a - k * b > c) k++;
      if (a - c < 0 && a - b >= 0) k = 1;
      if (k == 0) k++;
      if (a - k * b < 0) {
        cout << "No" << endl;
        goto END;
      }
      a = a - k * b + d;
      mp[a]++;
      if (mp[a] >= 2) {
        cout << "Yes" << endl;
        goto END;
      }
    }
    cout << "Yes" << endl;
  END:;
  }
}
