#include using namespace std; //#include //using namespace atcoder; typedef long long ll; typedef unsigned long long ull; const int MAX = 1e9; const int MIN = -1*1e9; const ll MAXLL = 1e18; const ll MINLL = -1*1e18; //const ll MOD = 998244353; //const ll MOD = 1000000007; int main() { int Q; cin >> Q; for(int q = 0; q < Q; q++) { int A,B; cin >> A >> B; vector> Ans; for(int i = -A; i <= A; i++) { for(int j = -A; j <= A; j++) { if(abs(i)+abs(j)==A) { Ans.push_back({abs(i)*abs(i)+abs(j)*abs(j),(to_string(i)+" "+to_string(j))}); } } } sort(Ans.begin(),Ans.end()); if(Ans.size() < B) { cout << "No" << endl; } else { cout << "Yes" << endl; cout << Ans[B-1].second << endl; } } return 0; }