#include <bits/stdc++.h>
using namespace std;
int check_sim(unsigned long long a_input, unsigned long long b,
              unsigned long long c, unsigned long long d) {
  unsigned long long a, cnt;
  unsigned long long *memo;
  a = a_input;
  memo = (unsigned long long *)malloc(b * sizeof(unsigned long long));
  cnt = 0;
  while (1) {
    a = a - ((a - c) / b) * b;
    if (a < b) a += b;
    for (unsigned long long i = 0; i < cnt; i++) {
      if (memo[i] == a) {
        free(memo);
        return 1;
      }
    }
    memo[cnt] = a;
    cnt++;
    a -= b;
    if (a <= c) a += d;
    if (a < b) break;
  }
  free(memo);
  return 0;
}
int main() {
  unsigned long long t, a, b, c, d;
  int ans;
  cin >> t;
  for (int i = 1; i <= t; i++) {
    cin >> a >> b >> c >> d;
    ans = 1;
    if (a < b)
      ans = 0;
    else {
      if (d >= b) {
        if ((b - 1) <= c)
          ans = 1;
        else {
          ans = check_sim(a, b, c, d);
        }
      } else
        ans = 0;
    }
    if (ans)
      cout << "yes" << endl;
    else
      cout << "no" << endl;
  }
  return 0;
}
