#include <bits/stdc++.h>
using namespace std;
int dy[5] = {0, 0, 1, -1, 0};
int dx[5] = {1, -1, 0, 0, 0};
int main(void) {
  long long int t;
  long long int now = 0;
  long long int tmp = 0;
  cin >> t;
  vector<long long int> a(t + 1), b(t + 1), c(t + 1), d(t + 1), pos(t + 1),
      cou(t + 1);
  vector<bool> res(t + 1, false);
  for (int i = (1); i <= (t); i++) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }
  for (int i = (1); i <= (t); i++) {
    now = 0;
    while (1) {
      now++;
      if (a[i] < b[i]) {
        break;
      }
      pos[i] = a[i] - c[i];
      if (pos[i] < 0) {
        pos[i] = 0;
      }
      if (pos[i] == 0) {
        cou[i] = 1;
      } else if (pos[i] % b[i] == 0) {
        cou[i] = pos[i] / b[i];
      } else {
        cou[i] = pos[i] / b[i];
        cou[i]++;
      }
      a[i] -= cou[i] * b[i];
      if (a[i] < 0) {
        break;
      } else {
        a[i] += d[i];
      }
      if (now > 800000) {
        res[i] = true;
        break;
      }
    }
  }
  for (int i = (1); i <= (t); i++) {
    if (res[i]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}
