#include <bits/stdc++.h>
using namespace std;
void work() {
  long long A, B, C, D;
  set<long long> s;
  cin >> A >> B >> C >> D;
  bool ok = true;
  for (long long t1, t2; ok;) {
    if (s.count(A)) break;
    s.insert(A);
    t1 = (A - C + B - 1) / B;
    t2 = A / B;
    if (!t2 || t2 < t1) {
      ok = false;
    } else {
      A = A - t2 * B + D;
    }
  }
  puts(ok ? "Yes" : "No");
}
int main() {
  int n;
  cin >> n;
  while (n--) work();
  return 0;
}
