#include int main() { int t; scanf("%d",&t); while(t--) { int n,m; scanf("%d%d",&n,&m); double n1,n2; n1=(double)((n-2)*180)/n; n2=(double)((m-2)*180)/m; //printf("%lf %lf\n",n1,n2); int i,j; bool cmp=0; for(i=0;i<=360/n1;i++) { for(j=0;j<=360/n2;j++) { if((n1*i+n2*j)==360) { cmp=1; break; } } if(cmp==1) break; } if(cmp==1) printf("Yes\n"); else printf("No\n"); } return 0; }