#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b)
{
if (a == 0)
return b;
return gcd(b%a, a);
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int T;
cin >> T;
while(T–) {
long long n,m;
cin>>n>>m;
long long sum=(n*(n+1))/2,sa=0,sb=0;
if(m>sum||((sum+m)%2)!=0)
cout<<“No”<<endl;
else{
sa=(sum+m)/2;
sb=sum-sa;
if(sa-sb==m){
if(gcd(sa,sb)==1)
cout<<“Yes”<<endl;
else
cout<<“No”<<endl;
}
else{
sb=(sum+m)/2;
sa=sum-sb;
if(gcd(sb,sa)==1)
cout<<“Yes”<<endl;
else
cout<<“No”<<endl;
}
}
}
return 0;
}
WHAT WRONG WITH THIS SPLIT SUMS INSOMNIA HELPP