#include <bits/stdc++.h>
using namespace std;
long long rev(long long prev, long long b) {
  long long mod = b - 2LL;
  long long base = 1LL;
  for (int i = 63; i >= 0; i--) {
    base = (base * base) % b;
    if (mod & (1LL << i)) base = (base * prev) % b;
  }
  return base;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    if (a < b) {
      cout << "No" << endl;
      continue;
    }
    if (b > d) {
      cout << "No" << endl;
      continue;
    }
    if (c >= (b - 1)) {
      cout << "Yes" << endl;
      continue;
    }
    d %= b;
    a %= b;
    if (c < a) {
      cout << "No" << endl;
      continue;
    }
    c -= a;
    long long dd = (c * rev(d, b)) % b;
    if (dd == (b - 2)) {
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
  }
  return 0;
}
