//============================================================================ // Name : ACM.cpp // Author : XenoAmess // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include using namespace std; int m, n; int T; int main() { scanf("%d", &T); while (T--) { scanf("%d%d", &n, &m); int a = 180 * (n - 2) * m; int b = 180 * (m - 2) * n; int c = 360 * m * n; for (int i = 0; i *a<=c; i++) { for (int j = 0;j*b<=c; j++) { if (i * a + j * b == c) { goto success; } } } goto fail; success: printf("Yes\n"); continue; fail: printf("No\n"); } return 0; }