#include <bits/stdc++.h>
using namespace std;
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(false);
  int t;
  cin >> t;
  long long a, b, c, d;
  while (t--) {
    cin >> a >> b >> c >> d;
    int ops = 0;
    while (a >= 0 && ops < 1000000) {
      if (a < b) break;
      long long r = max(0LL, (a - c)) / b;
      if (max(0LL, (a - c)) % b != 0) {
        ++r;
      }
      if (r == 0) ++r;
      a -= 1ll * r * b;
      if (a < 0) break;
      a += 1ll * d;
      ++ops;
    }
    if (ops >= 1000000)
      cout << "Yes\n";
    else {
      cout << "No\n";
    }
  }
}
