#include #include using namespace std; int main(){ int grid[16]; int vec[4] = {1, -1, 4, -1}; int current; for(int i = 0; i < 16; i++){ cin >> grid[i]; if(grid[i] == 0) current = i; } for(int i = 0; i < 16; i++){ for(int j = 0; j < 4; j++){ if(current + vec[j] >= 0 && current + vec[j] < 16 && grid[current + vec[j]] == current + 1){ swap(grid[current], grid[current + vec[j]]); current += vec[j]; break; } } } bool result = true; for(int i = 0; i < 15; i++){ if(grid[i] != i + 1) result = false; } if(result) cout << "Yes" << endl; else cout << "No" << endl; }