#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int deter = 0, a, b, c, d, N, key = 0;
  long long int k, cou = 10000;
  cin >> N;
  while (N--) {
    deter = 0, key = 0;
    cin >> a >> b >> c >> d;
    if (b == 1) {
      cout << "Yes" << endl;
    } else {
      long long int g = a;
      while (cou--) {
        int bo = 0;
        a = a - b;
        if (a < 0) {
          break;
        }
        a = a % b;
        if (key == 0) {
          k = a;
          key = 1;
          bo = 1;
        }
        if (a == g || (a == k && bo != 1)) {
          deter = 1;
          break;
        }
        if (a <= c) a += d;
      }
      if (deter)
        cout << "Yes" << endl;
      else
        cout << "No" << endl;
    }
  }
  return 0;
}
