#include <bits/stdc++.h>
using namespace std;
constexpr int INF = 2147483647;
constexpr long long INFF = 9223372036854775807;
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int T;
  cin >> T;
  long long A, B, C, D, now, same;
  bool flag = 0;
  for (long long query = 0; query < T; ++query) {
    flag = 0;
    cin >> A >> B >> C >> D;
    now = A;
    if (A < B) {
      cout << "No" << endl;
      continue;
    } else if (B <= C && B <= D) {
      cout << "Yes" << endl;
      continue;
    } else if (B <= C && B > D) {
      cout << "No" << endl;
      continue;
    }
    vector<long long> V;
    do {
      V.push_back(now);
      sort(V.begin(), V.end());
      long long mC = now - C;
      if (mC / B == 0)
        now -= B;
      else {
        mC %= B;
        now = mC + C;
        if (now >= B) now -= B;
      }
      if (C < now && now < B) {
        flag = 1;
        break;
      }
      if (now < 0) {
        flag = 1;
        break;
      }
      now += D;
    } while (!binary_search(V.begin(), V.end(), now));
    if (flag)
      cout << "No" << endl;
    else
      cout << "Yes" << endl;
  }
}
