#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);
      if (A - C <= 0) {
        puts("No");
        break;
      }
      ll x = (A - C - 1) / B;
      if (x > A / B - 1) {
        puts("No");
        break;
      }
      A = A - (x + 1) * B + D;
      if (S.find(A) != S.end()) {
        puts("Yes");
        break;
      }
    }
  }
  return 0;
}
