#include <bits/stdc++.h>
void add(long long array[], long long int num, long long count) {
  for (int i = 0; i < count; i++) {
    if (array[i] > num) {
      for (int j = count - 1; j >= i; j--) {
        array[j + 1] = array[j];
      }
      array[i] = num;
      break;
    }
  }
  array[count] = num;
}
int comp(const void *key, const void *data) {
  if (*(long *)key < *(long *)data) {
    return -1;
  } else if (*(long *)key == *(long *)data) {
    return 0;
  } else {
    return 1;
  }
}
int main(void) {
  long long t, a, b, c, d, i, array[100000], flag = 1, count = 0;
  for (i = 0; i < 100000; i++) {
    array[i] = -1;
  }
  scanf("%lld", &t);
  for (i = 0; i < t; i++) {
    scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
    while (1) {
      if ((a - c) > 0 && (a - b) > 0) {
        if (b < c) {
          a -= b * ((a - c) / b);
        } else {
          a -= b * ((a - b) / b);
        }
      }
      a -= b;
      if (a < 0) {
        flag = 0;
        break;
      }
      if (count > 0) {
        if ((bsearch(&a, array, count, sizeof(long long int), &comp)) != NULL) {
          break;
        }
        add(array, a, count);
        count++;
      } else {
        array[0] = a;
        count++;
      }
      if (a <= c) a += d;
    }
    if (flag) {
      printf("Yes\n");
    } else {
      printf("No\n");
    }
    flag = 1;
    count = 0;
  }
  return 0;
}
