#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> sub;
void dfs(int n, string s, int i, vector<int> choosed) {
  if (choosed.size() == n) {
    sub.push_back(choosed);
    return;
  }
  if (i == n * 2) {
    return;
  }
  if (n * 2 - i < n - choosed.size()) {
    return;
  }
  dfs(n, s, i + 1, choosed);
  choosed.push_back(i);
  dfs(n, s, i + 1, choosed);
}
void c() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> choosed;
  dfs(n, s, 0, choosed);
  auto check = [&](vector<int> subi) {
    string nest;
    string s_choosed;
    for (int i = 0; i < n * 2; ++i) {
      bool flag = true;
      for (int j = 0; j < n; ++j) {
        if (i == subi[j]) {
          flag = false;
        }
      }
      if (flag) {
        nest.push_back(s[i]);
      } else {
        s_choosed.push_back(s[i]);
      }
    }
    string ns = s_choosed + nest;
    int l = 0, r = 2 * n - 1;
    while (r > l) {
      if (ns[l] != ns[r]) {
        return false;
      }
      r--;
      l++;
    }
    return true;
  };
  long long int count = 0;
  vector<int> test = {0, 4, 6, 7};
  for (int i = 0; i < sub.size(); ++i) {
    if (check(sub[i])) {
      count++;
    }
  }
  cout << count << endl;
}
template <typename number>
pair<number, number> extended_euclid(number a, number b) {
  number r0, r1, a0, a1, b0, b1;
  r0 = a;
  r1 = b;
  a0 = 1;
  a1 = 0;
  b0 = 0;
  b1 = 1;
  while (r1 > 0) {
    number q1 = r0 / r1;
    number r2 = r0 % r1;
    number a2 = a0 - q1 * a1;
    number b2 = b0 - q1 * b1;
    r0 = r1;
    r1 = r2;
    a0 = a1;
    a1 = a2;
    b0 = b1;
    b1 = b2;
  }
  number c = r0;
  a = a0;
  b = b0;
  return {a, c};
}
int main() {
  int t;
  cin >> t;
  vector<tuple<long long int, long long int, long long int, long long int>> q(
      t);
  for (int i = 0; i < t; ++i) {
    long long int a, b, c, d;
    cin >> a >> b >> c >> d;
    q[i] = make_tuple(a, b, c, d);
  }
  for (int i = 0; i < t; ++i) {
    long long int a, b, c, d;
    a = get<0>(q[i]);
    b = get<1>(q[i]);
    c = get<2>(q[i]);
    d = get<3>(q[i]);
    if (c >= b && a >= b) {
      cout << "Yes" << endl;
    } else if (c + 1 == b) {
      cout << "Yes" << endl;
    } else {
      pair<long long int, long long int> result = extended_euclid(d, b);
      long long int gcd = result.second;
      long long int c1 = abs(c + 1 - a);
      c1 = c1 % gcd;
      long long int diff = b - c - 2;
      if (c1 == 0) {
        cout << "No" << endl;
      } else {
        if (gcd > c1) {
          if (c1 <= diff) {
            cout << "No" << endl;
          } else {
            cout << "Yes" << endl;
          }
        } else {
          if (gcd - c1 <= diff) {
            cout << "No" << endl;
          } else {
            cout << "Yes" << endl;
          }
        }
      }
    }
  }
  return 0;
}
