#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 1e6 + 5;
long long int power(long long int base, long long int exp, long long int mod) {
  long long int res = 1;
  while (exp) {
    if (exp % 2) res *= base;
    base *= base;
    res %= mod;
    base %= mod;
    exp /= 2;
  }
  return res;
}
map<long long int, long long int> mp;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t, a, b, c, d;
  cin >> t;
  while (t--) {
    cin >> a >> b >> c >> d;
    string ans = "No";
    mp.clear();
    long long int cnt = 0;
    clock_t st = clock();
    while (cnt < 5) {
      if (mp.find(a) != mp.end()) cnt++;
      mp[a] = 1;
      long long int val = (a - c - 1) / b;
      val = max(val, 1ll);
      if (a - val * b < b && a - val * b > c) {
        break;
      }
      a -= val * b;
      while (a > c) a -= b;
      if (a < 0) break;
      if (1.0 * (clock() - st) / CLOCKS_PER_SEC > 0.2) break;
      a += d;
    }
    if (cnt >= 5) ans = "Yes";
    cout << ans << "\n";
  }
  return 0;
}
