#include <bits/stdc++.h>
using namespace std;
int t;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> t;
  while (t--) {
    long long a, b, c, d;
    map<long long, int> mp;
    cin >> a >> b >> c >> d;
    if (a < b) {
      cout << "No" << endl;
      continue;
    }
    long long a2 = a - b * long long(a / b);
    while (true) {
      if (a2 < 0) {
        cout << "No" << endl;
        break;
      }
      if (mp[a2]) {
        cout << "Yes" << endl;
        break;
      } else
        mp[a2] = 1;
      if (a2 <= c) a2 += d;
      if (a2 >= 2 * b)
        a2 = a2 - b * long long(a2 / b);
      else
        a2 -= b;
    }
  }
  return 0;
}
