#include using namespace std; const int p = 67; int mod(int x) { x %= p; if (x < 0) x += p; return x; } int main() { int A[2][2], B[2][2]; for (int i = 0; i < 2; i++) for (int j = 0; j < 2; j++) { cin >> A[i][j]; A[i][j] = mod(A[i][j]); } for (int i = 0; i < 2; i++) for (int j = 0; j < 2; j++) { cin >> B[i][j]; B[i][j] = mod(B[i][j]); } // 変数: a,b,c,d // 4つの方程式 // a,b,c,d を 0~66 で全探索 (重いが小ケース用) for (int a = 0; a < p; a++) { for (int b = 0; b < p; b++) { for (int c = 0; c < p; c++) { for (int d = 0; d < p; d++) { int det = mod(a*d - b * c); if (det == 0) continue; // 行列式ゼロは除く // 方程式をチェック int eq1 = mod(a*A[0][0] + c * A[1][0] - B[0][0] * a - B[0][1] * b); int eq2 = mod(a*A[0][1] + c * A[1][1] - B[0][0] * c - B[0][1] * d); int eq3 = mod(b*A[0][0] + d * A[1][0] - B[1][0] * a - B[1][1] * b); int eq4 = mod(b*A[0][1] + d * A[1][1] - B[1][0] * c - B[1][1] * d); if (eq1 == 0 && eq2 == 0 && eq3 == 0 && eq4 == 0) { cout << "Yes\n"; return 0; } } } } } cout << "No\n"; return 0; }