#include <bits/stdc++.h>
using namespace std;
const double PI = 2 * acos(0.0), eps = 1e-8;
const long long oo = 1000000000000000000;
template <class T>
void show(const vector<T> &a) {
  cout << ((long long)(a.size())) << endl;
  for (T first : a) cout << first << " ";
  cout << endl;
}
const long long M = 998244353;
long long MOD(long long a) {
  if (a >= 0) return a >= M ? a % M : a;
  if (a <= -M) a %= M;
  return a ? a + M : a;
}
long long gcd(long long a, long long b) {
  while (a > 0) {
    if (a < b) swap(a, b);
    a %= b;
  }
  return b;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    long long second = gcd(gcd(a, b), gcd(c, d));
    a /= second;
    b /= second;
    c /= second;
    d /= second;
    if (a < b || d < b) {
      cout << "No" << endl;
      continue;
    }
    if (c >= b - 1) {
      cout << "Yes" << endl;
      continue;
    }
    long long lf = c + 1, rg = b - 1;
    long long poor = 0;
    map<long long, long long> mp;
    long long fl = false;
    while (true) {
      poor++;
      if (poor == 100000) break;
      long long second = a % b;
      if (second >= c + 1 && second <= b - 1) {
        fl = true;
        break;
      }
      if (mp[second] != 0) break;
      mp[second] = 1;
      a %= b;
      a += d;
    }
    if (fl || poor == 100000)
      cout << "No" << endl;
    else
      cout << "Yes" << endl;
  }
}
