#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const long long linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  if (a < b) return gcd(b, a);
  return gcd(b, a % b);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  for (int i = 0; i < ((int)t); i++) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    bool ans;
    if (a < b || d < b)
      ans = false;
    else if (b <= c)
      ans = true;
    else {
      long long w = gcd(b, d);
      if ((a - b) / w == (a - c) / w)
        ans = true;
      else if ((b - c) / w >= 2)
        ans = false;
      else {
        if ((a - c) % w == 0)
          ans = true;
        else
          ans = false;
      }
    }
    if (ans)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}
