#include <bits/stdc++.h>
using namespace std;
long long A, B, C, D;
bool ff[int(1e3) + 7];
int Hacxh(long long x) {
  int ans = 0, sum = 0;
  while (x > 0) {
    ans += (x % 10) * (++sum);
    x /= 10;
  }
  return ans % int(1e3) + 7;
}
int main() {
  int T;
  scanf("%d", &T);
  for (int time = 1; time <= T; time++) {
    bool f = 0;
    scanf("%lld%lld%lld%lld", &A, &B, &C, &D);
    if (A < B || D < B) f = 1;
    for (int k = 0;; k++) {
      int d = (A + D * k) % B;
      if (d > C || f) {
        printf("No\n");
        f = 1;
        break;
      }
      if (ff[Hacxh(d)] || f) break;
      ff[Hacxh(d)] = 1;
    }
    if (!f) printf("Yes\n");
    memset(ff, 0, sizeof(ff));
  }
}
