#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  int c;
  if (a < b) {
    a += b;
    b = a - b;
    a -= b;
  }
  while (b != 0) {
    c = a % b;
    a = b;
    b = c;
  }
  return a;
}
int main() {
  int T;
  cin >> T;
  int a[T], b[T], c[T], d[T];
  bool ans[T];
  for (int i = 0; i < T; i++) ans[i] = 1;
  for (int i = 0; i < T; i++) cin >> a[i] >> b[i] >> c[i] >> d[i];
  for (int i = 0; i < T; i++) {
    for (int j = 1; j < b[i] - c[i]; j++) {
      if ((c[i] + j - a[i] % b[i]) % gcd(b[i], d[i]) == 0) ans[i] = 0;
    }
    if (b[i] > d[i]) ans[i] = 0;
  }
  for (int i = 0; i < T; i++) {
    if (ans[i]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}
