#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long infl = 4557430888798830399ll;
const long long mod = 1e9 + 7;
int main() {
  int T, cnt, ok;
  long long a, b, c, d;
  scanf("%d", &T);
  while (T--) {
    scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
    cnt = 100000;
    ok = 1;
    while (cnt--) {
      a -= (a - c) / b * b;
      if (a > c) a -= b;
      if (a < 0) {
        ok = 0;
        break;
      }
      a += d;
    }
    if (ok)
      printf("Yes\n");
    else
      printf("No\n");
  }
}
