#include <bits/stdc++.h>
using namespace std;
double dot_product(complex<double> a, complex<double> b) {
  return (conj(a) * b).real();
}
double cross_product(complex<double> a, complex<double> b) {
  return (conj(a) * b).imag();
}
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
vector<int> G[100005];
std::vector<pair<long long, long long> > tree[100010];
int dx[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
int dy[9] = {0, 1, 0, -1, 1, -1, -1, 1, 0};
long long i, j, k, ii, jj;
long long n, m, sum, num;
long long ans = 0;
long long a, b, c, d, e, h, w;
long long x[500005], y[500005], z[500005];
char s[100005], t[100005];
bool ok = false;
bool check[100005];
long long gcd(long long a, long long b) {
  if (b > a) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  cin >> num;
  for (i = 0; i < num; i++) {
    cin >> a >> b >> c >> d;
    long long as = a;
    bool flag = false;
    for (j = 0; j < 10; j++) {
      as -= b;
      if (as < 0) {
        cout << "No" << endl;
        ;
        flag = true;
        break;
      }
      if (as <= c) as += d;
    }
    if (!flag) {
      long long x = gcd(b, d);
      long long y = a - ((a - c) / x) * x;
      if (c == y) y += x;
      if (y - b >= 0) {
        cout << "Yes" << endl;
        ;
      } else {
        cout << "No" << endl;
        ;
      }
    }
  }
  return 0;
}
