#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    long long a, b, c, d, f = 0;
    map<long long, int> h;
    cin >> a >> b >> c >> d;
    long long e = a % b;
    if (e > c || a < b) {
      cout << "NO\n";
      continue;
    }
    h[e]++;
    while ((e + d) % b <= c && e + d >= b) {
      e = (e + d) % b;
      if (h[e]) {
        cout << "YES\n";
        f = 1;
        break;
      }
      h[e]++;
    }
    if (!f) cout << "NO\n";
  }
  return 0;
}
