#include using namespace std; using ll =long long; #define all(v) v.begin(),v.end() #define rep(i,a,b) for(int i=a;i=b;i--) ll INF=2e18; int main() { ios::sync_with_stdio(false); cin.tie(0); ll Q;cin>>Q; for(ll i=0;i>D>>K; if(D==0) { if(K==1) { cout<<"Yes"< yu(20000+10); for(ll j=-100;j<=100;j++) { ll noko=D-abs(j); if(noko>=0) { ll x=j;ll y=noko; yu[x*x+y*y]++; if(noko>0) yu[x*x+y*y]++; } } for(ll j=1;j=0) { ll k=noko*noko+j*j; if(yu[k-1]=K) { cout<<"Yes"<