#include <bits/stdc++.h>
using namespace std;
long long t, a, b, c, d;
set<long long> s;
int main() {
  long long i, j;
  cin >> t;
  while (t--) {
    cin >> a >> b >> c >> d;
    s.clear();
    j = a;
    while (1) {
      if (j < b) {
        cout << "No\n";
        break;
      }
      i = (j - b) / b + 1;
      j = j - i * b;
      if (j <= c) j += d;
      if (s.count(j) == 1) {
        cout << "Yes\n";
        break;
      }
      s.insert(j);
    }
  }
  return 0;
}
