#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int t;
  long long int a[300];
  long long int b[300];
  long long int c[300];
  long long int d[300];
  std::cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }
  for (int i = 0; i < t; i++) {
    long long int num = a[i];
    for (;;) {
      num %= b[i];
      if (num <= c[i]) num += d[i];
      if (num < b[i]) {
        std::cout << "No" << std::endl;
        break;
      }
      if (num == a[i]) {
        std::cout << "Yes" << std::endl;
        break;
      }
    }
  }
  return 0;
}
