#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int tc;
  cin >> tc;
  while (tc--) {
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    set<ll> S;
    while (true) {
      S.insert(A);
      ll k = 1;
      if (A - C > B) {
        ll p = (A - C) / B;
        if ((A - C) % B != 0) p = p + 1;
        k = p;
      }
      if (A < k * B) {
        puts("No");
        break;
      }
      A = A - k * B + D;
      if (S.find(A) != S.end()) {
        puts("Yes");
        break;
      }
    }
  }
  return 0;
}
