#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 1;
const int INF = 1e9 + 9;
const int B = 1e9 + 7;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  long long t;
  cin >> t;
  for (int it = int(1); it <= int(t); ++it) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    if (d < b || a < b) {
      cout << "No\n";
      continue;
    }
    if (a > c) {
      a -= ((a / b) - (c / b)) * b;
      if (a <= c) a += b;
    }
    if (a < b) {
      cout << "No\n";
      continue;
    }
    if (c + 1 <= b - 1) {
      long long g = gcd(b, d);
      ++c, --b;
      if (b / g > 1 + c / g ||
          (c % g <= b % g ? c % g <= a % g && a % g <= b % g
                          : c % g <= a % g || a % g <= b % g)) {
        cout << "No\n";
        continue;
      }
    }
    cout << "Yes\n";
  }
  return 0;
}
