#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
int main() {
  ios_base::sync_with_stdio(false);
  long long t, a, b, c, d;
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> a >> b >> c >> d;
    long long now = a;
    long long check = a;
    long long count = 0;
    while (true) {
      count++;
      if (now / b == 0) {
        cout << "No" << endl;
        break;
      }
      now -= b * (now / b);
      if (now <= c) now += d;
      if (now == check) {
        cout << "Yes" << endl;
        break;
      }
      if (count == 100) {
        cout << "Yes" << endl;
        break;
      }
    }
  }
}
