#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int solve() {
  i64 A, B, C, D;
  cin >> A >> B >> C >> D;
  if (D - B < 0) {
    cout << "No" << endl;
    return 0;
  }
  set<i64> st;
  i64 now = A;
  int cnt = 0;
  while (cnt < 1e6 && !st.count(now)) {
    st.insert(now);
    if (now - C - 1 >= 0) {
      now = (now - C - 1) % B + C + 1;
    }
    now -= B;
    if (now < 0) {
      cout << "No" << endl;
      return 0;
    } else if (B - D == 0) {
      cout << "Yes" << endl;
      return 0;
    }
    now += (max(0LL, (C - now + 1)) / (D - B) +
            min(max(0LL, C - now + 1) % (D - B), 1LL)) *
           (D - B);
    cnt++;
  }
  cout << "Yes" << endl;
}
int main() {
  int T;
  cin >> T;
  for (int(i) = (0); (i) <= (T - 1); (i)++) {
    solve();
  }
}
