#include #include #include using namespace std; using ll = long long; int main() { bool ret = true; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { int x; cin >> x; if (x == 0)x += 16; x--; if (abs(i - (x / 4)) + abs(j - (x % 4)) > 1) ret = false; } } cout << (ret ? "Yes" : "No") << endl; return 0; }