#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  vector<int64_t> a(t), b(t), c(t), d(t);
  for (int i = 0; i < t; ++i) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }
  for (int i = 0; i < t; ++i) {
    if (a[i] < b[i]) {
      cout << "No\n";
      continue;
    }
    int64_t mod = a[i] - ((a[i] - c[i]) / b[i]) * b[i];
    unordered_set<int64_t> seen;
    seen.insert(mod);
    for (;;) {
      mod = mod - ((mod - c[i]) / b[i]) * b[i];
      if (mod <= c[i]) {
        mod += d[i];
      }
      mod -= b[i];
      if (mod < 0) {
        cout << "No\n";
        break;
      }
      if (seen.find(mod) == seen.end()) {
        seen.insert(mod);
      } else {
        cout << "Yes\n";
        break;
      }
    }
  }
}
