#include <bits/stdc++.h>
int T;
long long A, B, C, D;
bool solve() {
  long long cur = A;
  std::unordered_set<long long> s;
  while (true) {
    if (s.count(cur)) return true;
    s.insert(cur);
    if (B > cur) return false;
    cur %= B;
    if (cur <= C) cur += D;
  }
  return false;
}
int main() {
  std::cin >> T;
  while (T--) {
    std::cin >> A >> B >> C >> D;
    std::cout << (solve() ? "Yes" : "No") << "\n";
  }
  return 0;
}
