#include using namespace std; #define all(v) (v).begin(),(v).end() #define pb(a) push_back(a) #define rep(i, n) for(int i=0;i> q; rep(_, q) { int d, k; cin >> d >> k; priority_queue> pq; for(int i = -100; i <= 100; i ++) { for(int j = -100; j <= 100; j ++) { if(abs(i) + abs(j) == d) { pq.push({i * i + j * j, i, j}); if((int) pq.size() > k) pq.pop(); } } } if((int) pq.size() < k) { cout << "No" << endl; } else { cout << "Yes" << endl; auto [dis, x, y] = pq.top(); cout << x << " " << y << endl; } } return 0; }