#include using namespace std; #define ll long long #define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++) #define rrep(i, n, a) for (int i = (int)(n); i >= (int)(a); i--) void solve(){ int d,k; cin >> d >> k; vector>> dist; rep(i,0,d){ int x = i; int y = d-i; dist.push_back(make_pair(x*x+y*y, make_pair(x,y))); dist.push_back(make_pair(x*x+y*y, make_pair(-x,y))); dist.push_back(make_pair(x*x+y*y, make_pair(x,-y))); dist.push_back(make_pair(x*x+y*y, make_pair(-x,-y))); } sort(dist.begin(), dist.end()); if(dist.size() < k){ cout << "No"; } else{ cout << "Yes\n" << dist[k-1].second.first << " " << dist[k-1].second.second; } cout << '\n'; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; rep(i,0,t) solve(); return 0; }