#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i;
  long a, b, c, d, s, t;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%ld", &a);
    scanf("%ld", &b);
    scanf("%ld", &c);
    scanf("%ld", &d);
    vector<long> l;
    s = a - a / b * b;
    bool sc = true;
    while (1) {
      if (s < 0) {
        sc = false;
        break;
      }
      if (s <= c) {
        s += d;
      }
      t = s;
      s = s - s / b * b;
      if (t == s) {
        sc = false;
        break;
      }
      auto idx = find(l.begin(), l.end(), s);
      if (idx != l.end()) {
        break;
      }
      l.push_back(s);
    }
    if (sc) {
      printf("Yes\n");
    } else {
      printf("No\n");
    }
  }
  return 0;
}
