#include #include #include #include #include using namespace std; const double eps = 1e-8; bool Equal(double a, double b) { return fabs(a - b) < eps; } int main() { int tcase; scanf("%d", &tcase); while (tcase--) { int n, m; scanf("%d%d", &n, &m); double x = 180.0 - 360.0 / n; double y = 180.0 - 360.0 / m; bool ok = 0; for (int i = 0; i <= 100; ++i) for (int j = 0; j <= 100; ++j) if (Equal(i * x + j * y, 360.0)) { ok = 1; break; } if (ok) puts("Yes"); else puts("No"); } return 0; }