#include <bits/stdc++.h>
using namespace std;
int main() {
  long T;
  cin >> T;
  long long* A = new long long[T];
  long long* B = new long long[T];
  long long* C = new long long[T];
  long long* D = new long long[T];
  bool* result = new bool[T];
  for (int i = 0; i < T; i++) {
    cin >> A[i] >> B[i] >> C[i] >> D[i];
    long long firstA = A[i];
    vector<long long> history;
    while (true) {
      if (A[i] < B[i]) {
        result[i] = false;
        cout << "No" << endl;
        break;
      }
      long long take = (A[i] - C[i] - 1) / B[i] + 1;
      if (take <= 0) {
        take = 1;
      }
      A[i] -= take * B[i];
      if (A[i] < 0) {
        result[i] = false;
        cout << "No" << endl;
        break;
      }
      auto itr = std::find(history.begin(), history.end(), A[i]);
      size_t index = std::distance(history.begin(), itr);
      if (index != history.size()) {
        result[i] = true;
        cout << "Yes" << endl;
        break;
      }
      history.push_back(A[i]);
      A[i] += D[i];
    }
  }
  return 0;
}
