#include #include #include #include #include #include #include #define N 100005 #define ll long long #define MOD 1000000007 #define MAX 100000000 using namespace std; int main() { int t; cin>>t; while (t--) { int n,m,max; cin>>n>>m; double x1=((n-2)*180.)/n,x2=((m-2)*180.)/m; if (360/x1>360/x2) max=360/x1+1; else max=360/x2+1; int flag=0; for (int i=0;i<=max;i++) for (int j=0;j<=max;j++) if (fabs((i*x1+j*x2)-360)<=1e-7) { flag=1; break; } if (flag) printf("Yes\n"); else printf("No\n"); } }