#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  long long a, b, c, d;
  cin >> t;
  while (t--) {
    cin >> a >> b >> c >> d;
    set<long long> s;
    s.insert(a);
    bool ans = true;
    for (int i = 0; i < 30000; i++) {
      if (a < b) {
        ans = false;
        break;
      } else if (a == b) {
        if (b > d) {
          ans = false;
          break;
        }
        a = d;
        auto check = s.insert(a);
        if (!check.second) {
          ans = true;
          break;
        }
      }
      if (a == c) {
        a = a - b + d;
        auto check = s.insert(a);
        if (!check.second) {
          ans = true;
          break;
        }
      } else if ((a - c) % b == 0) {
        a = c + d;
        auto check = s.insert(a);
        if (!check.second) {
          ans = true;
          break;
        }
      } else {
        if (a - b * (1LL + (a - c) / b) < 0) {
          ans = false;
          break;
        }
        a = a + d - b * (1LL + (a - c) / b);
        auto check = s.insert(a);
        if (!check.second) {
          ans = true;
          break;
        }
      }
    }
    if (ans)
      cout << "Yes\n";
    else
      cout << "No\n";
  }
  return 0;
}
