#include <bits/stdc++.h>
using namespace std;
unordered_map<long long, long long> mp;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long i, j, x, y, n, m, z, sz, p, q, r, tc;
  cin >> tc;
  while (tc--) {
    mp.clear();
    cin >> x >> y >> z >> p;
    if (x < y) {
      cout << "No" << endl;
      continue;
    }
    long long flg = 0;
    mp[x]++;
    while (1) {
      x %= y;
      if (mp[x]) {
        cout << "Yes" << endl;
        break;
      }
      mp[x]++;
      if (x <= z) {
        x += p;
      }
      if (x < y) {
        cout << "No" << endl;
        break;
      }
    }
  }
  return 0;
}
