#include <bits/stdc++.h>
using namespace std;
void hawawa() {
  int t;
  cin >> t;
  while (t--) {
    set<long long> s;
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    while (true) {
      if (a < b) {
        cout << "No\n";
        break;
      }
      a %= b;
      if (s.count(a)) {
        cout << "Yes\n";
        break;
      }
      s.insert(a);
      if (c < a) {
        cout << "No\n";
        break;
      }
      a += d;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  hawawa();
  return 0;
}
