#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100005;
long long gcd(long long a, long long b) {
  if (!b) return a;
  if (a % b == 0) {
    return b;
  } else {
    return gcd(b, a % b);
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int T;
  cin >> T;
  for (int i = 0; i < (int)(T); ++i) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    if (a < b || d < b) {
      cout << "NO\n";
      continue;
    }
    if (c >= b - 1) {
      cout << "YES\n";
      continue;
    }
    long long pr = a % b, nx;
    long long cnt = (a - c - 1) / b + 1;
    nx = (a - cnt * b + d) % b;
    long long ad = (nx + b - pr) % b;
    long long g = gcd(b, ad);
    if (pr >= c + 1) {
      cout << "NO\n";
      continue;
    }
    if ((b - 1 - pr) / g - (c - pr) / g >= 1) {
      cout << "NO\n";
    } else {
      cout << "YES\n";
    }
  }
  return 0;
}
