#include <bits/stdc++.h>
using namespace std;
void check(long long a, long long b, long long c, long long d) {
  map<long long, int> make_pair;
  int pl = a % b;
  for (; make_pair[pl] != 2; a %= b) {
    make_pair[a]++;
    if (a <= c) a += d;
    if (a < b) {
      cout << "No" << endl;
      return;
    }
  }
  cout << "Yes" << endl;
}
int main() {
  int n;
  long long a, b, c, d;
  cin >> n;
  while (n--) {
    cin >> a >> b >> c >> d;
    check(a, b, c, d);
  }
  return 0;
}
