#include <bits/stdc++.h>
using namespace std;
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(false);
  int t;
  cin >> t;
  long long a, b, c, d;
  while (t--) {
    cin >> a >> b >> c >> d;
    int ops = 0;
    set<long long> seen;
    bool bad = 0;
    if (a < b) {
      cout << "No\n";
      continue;
    }
    if (d < b) {
      cout << "No\n";
      continue;
    }
    if (c >= b - 1) {
      cout << "Yes\n";
      continue;
    }
    while (a > 0 && ((int)((seen).size())) < 500000) {
      seen.insert(a);
      if (a < b) break;
      long long r = max(0LL, (a - c)) / b;
      if (max(0LL, (a - c)) % b != 0) {
        ++r;
      }
      if (r == 0) ++r;
      a -= 1ll * r * b;
      if (a < 0) break;
      a += 1ll * d;
      if (seen.find(a) != seen.end()) {
        bad = 1;
        break;
      }
      ++ops;
    }
    if (!bad && ((int)((seen).size())) < 500000)
      cout << "No\n";
    else
      cout << "Yes\n";
  }
}
