#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int k = 1; k <= t; k++) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    long long x = a;
    while (1) {
      a %= b;
      if (a <= c) {
        a += d;
      } else {
        cout << "NO" << endl;
        break;
      }
      if (a == x) {
        cout << "YES" << endl;
        break;
      }
    }
  }
  return 0;
}
