#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  long long a, b, c, d, m;
  vector<long long> vd, vu;
  for (int i = 0; i < t; i++) {
    cin >> a >> b >> c >> d;
    m = a;
    while (true) {
      if (m < b) {
        cout << "No\n";
        break;
      }
      m -= b * (m / b);
      if (count(vd.begin(), vd.end(), m)) {
        cout << "Yes\n";
        break;
      }
      vd.push_back(m);
      if (m <= c) {
        m += d;
        if (count(vu.begin(), vu.end(), m)) {
          cout << "Yes\n";
          break;
        }
        vu.push_back(m);
      }
    }
    vd.clear();
    vu.clear();
  }
  return 0;
}
