#include #include #include using namespace std; #define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++) #define REP(i, n) FOR(i, 0, n) constexpr int P = 67; using Mat = array; Mat prod(const Mat &a, const Mat &b) { return {(a[0] * b[0] + a[1] * b[2]) % P, (a[0] * b[1] + a[1] * b[3]) % P, (a[2] * b[0] + a[3] * b[2]) % P, (a[2] * b[1] + a[3] * b[3]) % P}; } int main() { Mat A, B, C; cin >> A[0] >> A[1] >> A[2] >> A[3]; cin >> B[0] >> B[1] >> B[2] >> B[3]; REP(i, P) REP(j, P) REP(k, P) REP(l, P) { C[0] = i, C[1] = j, C[2] = k, C[3] = l; auto det = (i * l - j * k) % P; if (det == 0) continue; // Not invertible if (prod(C, A) == prod(B, C)) { puts("Yes"); return 0; } } puts("No"); }