#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
const int MAX = 55;
const int mod = 1e9 + 7;
int t;
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr);
  long long a, b, c, d;
  cin >> t;
  while (t--) {
    cin >> a >> b >> c >> d;
    unordered_map<int, int> vis;
    vis[a] = 1;
    do {
      a %= b;
      vis[a] = 1;
      if (a <= c) a += d;
    } while (!vis[a] and a > b);
    if (a < b)
      cout << "No\n";
    else
      cout << "Yes\n";
  }
  return 0;
}
