#include <bits/stdc++.h>
using namespace std;
template <typename T>
void chmax(T &a, T b) {
  a = max(a, b);
}
template <typename T>
void chmin(T &a, T b) {
  a = min(a, b);
}
template <typename T>
void chadd(T &a, T b) {
  a = a + b;
}
long long int dx[] = {0, 0, 1, -1};
long long int dy[] = {1, -1, 0, 0};
const long long INF = 1001001001001001LL;
const long long MOD = 1000000007LL;
signed main() {
  long long int T;
  cin >> T;
  while (T--) {
    long long int A, B, C, D;
    cin >> A >> B >> C >> D;
    set<long long int> S;
    long long int cur = A;
    bool can = true;
    while (1) {
      if (cur < B) {
        can = false;
        break;
      }
      long long int ub = 2e18 / B, lb = 0;
      while (ub - lb > 1) {
        long long int mid = (ub + lb) / 2;
        if (cur - mid * B <= C) {
          ub = mid;
        } else {
          lb = mid;
        }
      }
      cur -= ub * B;
      if (cur < 0) {
        can = false;
        break;
      }
      if (S.count(cur)) break;
      S.insert(cur);
      cur += D;
    }
    cout << (can ? "Yes" : "No") << endl;
  }
  return 0;
}
