#include using namespace std; using ll = long long; bool chmin(auto &a, auto b) { return a > b ? a = b, true : false; } bool chmax(auto &a, auto b) { return a < b ? a = b, true : false; } using V = array; using Mat = array; const int p = 67; Mat mul(Mat a, Mat b) { Mat c = Mat{V{0, 0}, V{0, 0}}; for (int i = 0; i < 2; i++) { for (int k = 0; k < 2; k++) { for (int j = 0; j < 2; j++) { c[i][j] += a[i][k] * b[k][j]; c[i][j] %= p; } } } return c; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); Mat A, B; for (int s : {0, 1}) { for (int t : {0, 1}) cin >> A[s][t]; } for (int s : {0, 1}) { for (int t : {0, 1}) cin >> B[s][t]; } 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++) { if (a * d == b * c) continue; Mat P = Mat{V{a, b}, V{c, d}}; auto L = mul(P, A); auto R = mul(B, P); if (L == R) { cout << "Yes\n"; return 0; } } } } } cout << "No\n"; }