#include <bits/stdc++.h>
using namespace std;
bool solve() {
  long a, b, c, d;
  cin >> a >> b >> c >> d;
  for (long i = 0; i < 100000; i++) {
    long q = a / b;
    long r = a % b;
    a = r;
    if (q == 0) {
      return false;
    }
    if (a <= c) {
      a += d;
    }
  }
  return true;
}
int main(void) {
  long t;
  cin >> t;
  for (long i = 0; i < t; i++) {
    bool b = solve();
    cout << (b ? "Yes" : "No") << endl;
  }
  return 0;
}
