#include <bits/stdc++.h>
using namespace std;
bool func() {
  long a, b, c, d, ch;
  cin >> a >> b >> c >> d;
  if (b > c)
    ch = b;
  else
    ch = c + 1;
  bool *log = new bool[ch];
  for (int i = 0; i < ch; i++) log[i] = false;
  while (true) {
    ch = a % b;
    if (ch == a) {
      delete[] log;
      return false;
    }
    a = ch;
    if (a > c) {
      delete[] log;
      return false;
    }
    if (log[a]) {
      delete[] log;
      return true;
    }
    log[a] = true;
    a += d;
  }
}
void ans(bool ans) {
  if (ans)
    cout << "Yes\n";
  else
    cout << "No\n";
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) ans(func());
}
