#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    ll a, b, c, d;
    scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
    bool ans = true;
    set<ll> fnd;
    for (int i = 0; i < 1e6; ++i) {
      if (a < b) {
        ans = false;
        break;
      }
      ll l = (a - c + b - 1) / b;
      a -= l * b;
      if (a < 0) {
        ans = false;
        break;
      }
      if (a <= c) a += d;
      if (fnd.count(a)) break;
      fnd.insert(a);
    }
    if (ans)
      printf("Yes\n");
    else
      printf("No\n");
  }
  return 0;
}
