#include <bits/stdc++.h>
using namespace ::std;
int main(void) {
  int num;
  cin >> num;
  cin.ignore();
  vector<string> ans;
  vector<string> input(num);
  for (int i = 0; i < num; i++) {
    getline(cin, input.at(i));
  }
  for (auto str : input) {
    stringstream ss(str);
    string buf;
    unsigned long int a, b, c, d;
    ss >> buf;
    a = stoul(buf);
    ss >> buf;
    b = stoul(buf);
    ss >> buf;
    c = stoul(buf);
    ss >> buf;
    d = stoul(buf);
    unsigned long int n = a;
    while (true) {
      if (n < b) break;
      n -= b;
      if (n <= c) n += d;
      if (n == a) break;
    }
    if (n < b)
      ans.push_back("No");
    else if (n == a)
      ans.push_back("Yes");
  }
  for (auto x : ans) cout << x << endl;
  return 0;
}
