#include <iostream>
using namespace std;
bool sanjiao(int a,int x,int y){
    if(a+x>y&&a+y>x&&x+y>a)return true;
    else return false;
}
bool gcd(int x,int y){
    int v=x<y?x:y;
    int Max=0;
    for(int i=1;i<=v;i++){
        if(x%i==0&&y%i==0&&i>Max)Max=i;
    }
    if(sanjiao(Max,x,y))return true;
    else return false;
}
int main() {
    int n;cin>>n;
    while(n--){
        int x,y;
        cin>>x>>y;
        if(gcd(x, y))cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}