#include <bits/stdc++.h>
using namespace std;
const int Mod = 1e9 + 7;
int dcmp(double x) {
  if (fabs(x) <= 1e-7) return 0;
  return x < 0 ? -1 : 1;
}
struct Point {
  double x, y;
  Point(double x = 0, double y = 0) : x(x), y(y) {}
  bool operator<(const Point &a) const {
    if (x == a.x) return y < a.y;
    return x < a.x;
  }
  Point operator-(const Point &a) const { return Point(x - a.x, y - a.y); }
  Point operator+(const Point &a) const { return Point(x + a.x, y + a.y); }
  Point operator*(const double &a) const { return Point(x * a, y * a); }
  Point operator/(const double &a) const { return Point(x / a, y / a); }
  void read() { scanf("%lf%lf", &x, &y); }
  void out() { cout << "debug: " << x << " " << y << endl; }
  bool operator==(const Point &a) const {
    return dcmp(x - a.x) == 0 && dcmp(y - a.y) == 0;
  }
};
double Dot(Point a, Point b) { return a.x * b.x + a.y * b.y; }
double dis(Point a) { return Dot(a, a); }
double Cross(Point a, Point b) { return a.x * b.y - a.y * b.x; }
int ConvexHull(Point *p, int n, Point *ch) {
  int m = 0;
  for (int i = 0; i < n; i++) {
    while (m > 1 && Cross(ch[m - 1] - ch[m - 2], p[i] - ch[m - 2]) <= 0) m--;
    ch[m++] = p[i];
  }
  int k = m;
  for (int i = n - 1; i >= 0; i--) {
    while (m > k && Cross(ch[m - 1] - ch[m - 2], p[i] - ch[m - 2]) <= 0) m--;
    ch[m++] = p[i];
  }
  if (n > 1) m--;
  return m;
}
int n;
long long a, b, c, d;
set<long long> s;
void solve() {
  cin >> a >> b >> c >> d;
  s.clear();
  while (1) {
    if (a < b) {
      cout << "No" << endl;
      return;
    }
    a = a % b;
    if (s.count(a)) {
      cout << "Yes" << endl;
      return;
    }
    if (a > c) {
      cout << "No" << endl;
      return;
    }
    s.insert(a);
    a = a + d;
  }
}
int main() {
  ios::sync_with_stdio(false);
  int t = 0;
  cin >> t;
  while (t--) solve();
  return 0;
}
