#include #include #include #include #include #include #include using namespace std; int main(){ int T,n,m; scanf("%d",&T); while(T--){ scanf("%d%d",&n,&m); int j1=(n-2)*180/n; int j2=(m-2)*180/m; int ok=0; for(int i=0;i<=360;i++){ for(int j=0;j<=360;j++){ if(i*j1+j*j2==360){ ok=1; break; } } } if(ok){ cout<<"Yes"<