#include <bits/stdc++.h>
const long long INFLL = 1e18;
using namespace std;
const int MAXN = 100000;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    set<long long> was;
    bool ok = false;
    while (was.size() < MAXN) {
      long long cnt = max(1LL, min((max(0LL, a - c) + b - 1) / b, a / b));
      a -= b * cnt;
      if (a < 0) {
        break;
      }
      if (a <= c) {
        a += d;
      }
      if (a < b) {
        break;
      }
      if (was.find(a) != was.end()) {
        ok = true;
        break;
      }
      was.insert(a);
    }
    if (ok) {
      cout << "Yes\n";
    } else {
      cout << "No\n";
    }
  }
  return 0;
}
