#include #include #include #include #include #include #include const int mx=1086; using namespace std; int a[55][55]; int main() { int t; cin>>t; while(t--) { int n,m; cin>>n>>m; double n1,m1; n1=(n-2)*180/n; m1=(m-2)*180/m; int y=0,x=360/n1,i; for(i=0;i<=x;i++) { if(fmod(360-i*n1,m1)==0) y=1; } if(y) printf("Yes\n"); else printf("No\n"); } return 0; }