#include <iostream>
using namespace std;

int main() {
    int t;
    cin >>t;
    int x, y, n, max;
    while(t--){
        cin >>x >>y;
        n = x > y ? x :y;
        for(int i = 1; i <=n; i++){
            if(x %i == 0 && y %i == 0){
                max = i;
            }
        }
        if((x+y) > max&& (x+max) >y &&(y +max) > x){
            cout << "Yes"<<endl;
        }else{
            cout << "No" <<endl;
        }
    }
}
// 64 位输出请用 printf("%lld")