#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
const int inf = 1 << 30;
const int mod = 1e9 + 7;
map<long long, int> mp;
struct point {
  int x, y;
};
int main() {
  int t;
  cin >> t;
  int pos = 0;
  while (t--) {
    long long a, b, c, d;
    mp.clear();
    scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
    if (a < b) {
      printf("No\n");
      continue;
    }
    long long ans = 0;
    bool vis = true;
    while (!mp[a]) {
      mp[a] = 1;
      if (a % b > c || a < b) {
        vis = false;
        break;
      }
      a = a % b;
      a += d;
    }
    if (vis)
      printf("Yes\n");
    else
      printf("No\n");
  }
}
