#include <bits/stdc++.h>
#pragma comment(linker, "/stack:16777216")
using namespace std;
bool check(long long a, long long b, long long c, long long d) {
  if (a < b || b > d) return 0;
  if (a == c || b == 1 || a == b || (b == d && a - b <= c)) return 1;
  if (b == d) return 0;
  long long f = d - b, g = (c / f + 1ll) * f;
  if (g == a) return 1;
  return check(g, b, c, d);
}
signed main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    if (check(a, b, c, d))
      puts("Yes");
    else
      puts("No");
  }
  return 0;
}
