#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<unsigned long long> v;
  unsigned long long t, a, b, c, d;
  cin >> t;
  while (t--) {
    cin >> a >> b >> c >> d;
    int step = 30;
    v.clear();
    bool flag = true;
    while (step--) {
      if (a < b) {
        flag = false;
        break;
      }
      a %= b;
      if (find(v.begin(), v.end(), a) != v.end()) break;
      if (a <= c) a += d;
      v.push_back(a);
    }
    if (flag)
      cout << "Yes";
    else
      cout << "No";
    cout << "\n";
  }
  return 0;
}
