#include using namespace std; int main(){ int Q; cin >> Q; for (int i = 0; i < Q; i++){ int D, K; cin >> D >> K; vector> P; for (int j = -D; j <= D; j++){ for (int k = -D; k <= D; k++){ if (abs(j) + abs(k) == D){ P.push_back(make_pair(j, k)); } } } sort(P.begin(), P.end(), [&](pair a, pair b){ return a.first * a.first + a.second * a.second < b.first * b.first + b.second * b.second; }); if (K > P.size()){ cout << "No" << endl; } else { cout << "Yes" << endl; cout << P[K - 1].first << ' ' << P[K - 1].second << endl; } } }