#include <bits/stdc++.h>
int main(int argc, char* argv[]) {
  int t;
  std::cin >> t;
  std::vector<long long> ss;
  for (int i = 0; i < t; i++) {
    long long a_i, b_i, c_i, d_i;
    std::cin >> a_i >> b_i >> c_i >> d_i;
    long long s = a_i;
    while (1) {
      long long n;
      if (s < b_i) {
        std::cout << "No" << std::endl;
        break;
      }
      if (s <= c_i) {
        n = 1;
      } else if ((s - c_i) % b_i == 0) {
        n = (s - c_i) / b_i;
      } else {
        n = (s - c_i) / b_i + 1;
      }
      s -= b_i * n;
      if (s < 0) {
        std::cout << "No" << std::endl;
        break;
      }
      s += d_i;
      if (ss.empty()) {
        ss.push_back(s);
      } else if (std::find(ss.begin(), ss.end(), s) != ss.end()) {
        std::cout << "Yes" << std::endl;
        break;
      } else {
        ss.push_back(s);
      }
    }
    ss.clear();
  }
  return 0;
}
