#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int query = 0; query < t; query++) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    map<long long, bool> m;
    while (a >= 0 && !m[a]) {
      m[a] = true;
      a -= b;
      a = a - max((long long)0, (a - c)) / b * b;
      if (a <= c && a >= 0) a += d;
    }
    if (a < 0)
      cout << "No" << endl;
    else
      cout << "Yes" << endl;
  }
  return 0;
}
