#include <bits/stdc++.h>
int main() {
  int t;
  long long a, b, c, d;
  std::cin >> t;
  for (int k = 0; k < t; ++k) {
    std::cin >> a >> b >> c >> d;
    long long ans[100001];
    if (a < b)
      std::cout << "No" << std::endl;
    else {
      long long a_ = a;
      a_ -= c;
      a_ %= b;
      a_ += c;
      if (a_ + d < b)
        std::cout << "No" << std::endl;
      else {
        a_ += d;
        a_ -= b;
        ans[0] = a_;
        int now = 1;
        while (1) {
          if (a_ >= b) {
            a_ -= c;
            a %= b;
            a_ += c;
            ans[now] = a_;
          } else {
            a_ += c;
            ans[now] = a_;
            if (a_ < b) {
              std::cout << "No" << std::endl;
              return 0;
            }
          }
          now++;
          if (now % 2 == 0) {
            bool f = false;
            for (int i = 0; i < now / 2; ++i) {
              if (ans[i] != ans[i + now / 2]) {
                f = true;
                break;
              }
            }
            if (!f) {
              std::cout << "Yes" << std::endl;
              return 0;
            }
          }
        }
      }
    }
  }
  return 0;
}
