#include <bits/stdc++.h>
using ll = long long;
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long INFLL = 1LL << 60;
const int INF = 1 << 30;
const double PI = acos(-1);
int main() {
  int t;
  ll a, b, c, d;
  bool ans = true;
  cin >> t;
  set<ll> dis;
  for (int i = 0, i_len = (int)(t); i < i_len; i++) {
    cin >> a >> b >> c >> d;
    dis.clear();
    a = max(-1LL, a - ((a - c + b - 1) / b) * b);
    dis.insert(a);
    if (a == -1) {
      cout << ((0) ? "Yes" : "No") << endl;
      continue;
    }
    while (a > -1) {
      a += c;
      a = max(-1LL, a - ((a - c + b - 1) / b) * b);
      if (a == -1) {
        cout << ((0) ? "Yes" : "No") << endl;
      }
      if (dis.find(a) != dis.end()) {
        cout << ((1) ? "Yes" : "No") << endl;
        break;
      }
      dis.insert(a);
    }
  }
}
