#include <bits/stdc++.h>
using namespace std;
unordered_map<long long, long long> mp;
long long a[10005];
int main() {
  long long i, j, x, y, n, m, z, sz, p, q, r, tc, d, c;
  cin >> tc;
  while (tc--) {
    mp.clear();
    cin >> x >> y >> z >> p;
    if (x < y) {
      printf("No\n");
      continue;
    }
    long long flg = 1;
    mp[x]++;
    while (flg < 10000) {
      x %= y;
      a[flg++] = x;
      if (mp[x]) {
        printf("Yes\n");
        break;
      }
      mp[x]++;
      if (x <= z) {
        x += p;
      }
      if (x < y) {
        printf("No\n");
        break;
      }
    }
    if (flg == 10000) {
      d = a[2] - a[1];
      c = z - a[1];
      c %= d;
      z -= c;
      z += d;
      if (z < y) {
        printf("No\n");
      } else {
        printf("Yes\n");
      }
    }
  }
  return 0;
}
