#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  for (int i = 0; i < T; i++) {
    long long A, B, C, D;
    cin >> A >> B >> C >> D;
    unordered_set<long long> memo;
    long long x = A;
    while (true) {
      x -= B;
      if (x < 0) {
        cout << "No" << endl;
        break;
      }
      x -= B * (long long)(x / B);
      if (x <= C) {
        x += D;
      }
      if (memo.find(x) != memo.end()) {
        cout << "Yes" << endl;
        break;
      }
      memo.emplace(x);
    }
  }
  return 0;
}
