#include <bits/stdc++.h>
using namespace std;
using LL = long long;
int main() {
  LL n, a, b, c, d, mod, omod, next;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b >> c >> d;
    if (a < b) {
      cout << "No" << endl;
      continue;
    }
    if (b == 1) {
      cout << "Yes" << endl;
      continue;
    }
    next = a;
    mod = next % b;
    next = mod + d;
    omod = a % b;
    while (mod <= c && next != a) {
      mod = next % b;
      next = mod + d;
      if ((a != next) * mod != omod) break;
    }
    cout << omod << " " << mod << endl;
    if ((next == a || omod == mod) && mod <= c)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}
