#include <bits/stdc++.h>
const double EPS = 1e-10;
const double PI = acos(-1.0);
using namespace std;
int EDSum(long long);
vector<int> SOE(int, int);
int MinCM(int, int);
int MaxCD(int, int);
vector<int> igets(int);
long long nPr(long long, long long);
long long nE(long long);
long long nCr(long long, long long);
bool VFIN(vector<int> VEC, int s) {
  for (int look = 0; look < VEC.size(); ++look) {
    if (VEC[look] == s) return true;
  }
  return false;
}
void solve() {
  int T;
  cin >> T;
  for (int loop = 0; loop < T; ++loop) {
    long long A, B, C, D;
    vector<int> pattern1;
    vector<int> pattern2;
    cin >> A >> B >> C >> D;
    long long re = MinCM(B, C);
    while (1) {
      if (A >= re)
        A %= re;
      else
        A -= B;
      if (A < 0) {
        cout << "No" << endl;
        break;
      }
      if (A <= C) A += D;
      if (VFIN(pattern1, A)) {
        cout << "Yes" << endl;
        break;
      } else
        pattern1.push_back(A);
    }
  }
}
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}
int EDSum(long long number) {
  int ans = 0;
  while (1) {
    ans += number % 10;
    number /= 10;
    if (number == 0) break;
  }
  return ans;
}
vector<int> SOE(int min, int max) {
  if (min < 2) min = 2;
  vector<int> int_array;
  for (int i = min; i <= max; i++) int_array.push_back(i);
  vector<int> sosu;
  double stop = sqrt(max);
  while (true) {
    sosu.push_back(int_array.front());
    int_array.erase(int_array.begin());
    if (stop < (double)(sosu.back())) break;
    for (int i = 0; i < (int)int_array.size(); i++) {
      if (int_array[i] % sosu.back() == 0)
        int_array.erase(int_array.begin() + i);
    }
  }
  sosu.insert(sosu.end(), int_array.begin(), int_array.end());
  return sosu;
}
int MinCM(int a, int b) {
  int c = a * b;
  if (a < b) swap(a, b);
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return c / b;
}
int MaxCD(int a, int b) {
  if (a < b) swap(a, b);
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
vector<int> igets(int N) {
  vector<int> A;
  int temp;
  for (int i = 0; i < N; ++i) {
    cin >> temp;
    A.push_back(temp);
  }
  return A;
}
long long nPr(long long n, long long r) {
  long long ans = 1;
  r = n - r;
  while (n != r) {
    ans *= n;
    --n;
  }
  return ans;
}
long long nE(long long n) { return nPr(n, n); }
long long nCr(long long n, long long r) {
  if (r == 0)
    return -1;
  else {
    if (0 != n - r && n - r < r) r = n - r;
    return nPr(n, r) / nE(r);
  }
}
