#include using namespace std; #include #include int main() { int t,n,m,i,h1,h2,sign,j; cin>>t; while(t--) { cin>>n>>m; h1=(n-2)*180/n; h2=(m-2)*180/m; sign=0; for(i=0;i<=360/h1;i++) { for(j=0;j<=360/h2;j++) if(h1*i+h2*j==360) { sign=1; break; } if(sign)break; } if(sign)cout<<"Yes\n"; else cout<<"No\n"; } return 0; }