// g++-13 4.cpp -std=c++17 -O2 -I . #include using namespace std; #include using namespace atcoder; using ll = long long; using ld = long double; using vi = vector; using vvi = vector; using vll = vector; using vvll = vector; using vld = vector; using vvld = vector; using vst = vector; using vvst = vector; #define fi first #define se second #define pb push_back #define eb emplace_back #define pq_big(T) priority_queue,less> #define pq_small(T) priority_queue,greater> #define all(a) a.begin(),a.end() #define rep(i,start,end) for(ll i=start;i<(ll)(end);i++) #define per(i,start,end) for(ll i=start;i>=(ll)(end);i--) #define uniq(a) sort(all(a));a.erase(unique(all(a)),a.end()) int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int q;cin>>q; while(q--){ int d,k;cin>>d>>k; if(d==0){ if(k==0){ cout<<"Yes"<> v; rep(x,0,d+1){ int y=d-x; int ds=x*x+y*y; v.emplace_back(ds,x,y); if(x!=0&&y!=0)v.emplace_back(ds,-x,-y); if(x!=0)v.emplace_back(ds,-x,y); if(y!=0)v.emplace_back(ds,x,-y); } sort(all(v)); cout<<"Yes"<