#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  unsigned long long int a, b, c, d;
  while (t--) {
    cin >> a >> b >> c >> d;
    unsigned long long int q = a;
    map<unsigned long long int, bool> m;
    unsigned long long int c = 0;
    while (c++) {
      if (q < b) {
        cout << "No\n";
        break;
      }
      m[q] = true;
      q = q % b;
      if (q <= c) {
        q += d;
      }
      if (m[q]) {
        cout << "Yes\n";
        break;
      }
      if (c > 10000000) {
        cout << "No\n";
      }
    }
  }
  return 0;
}
