#include using namespace std; int visited[4][4]; vector> ok={{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,0}}; int mx[]={1,-1,0,0},my[]={0,0,1,-1}; bool dfs(vector> a,int x,int y){ if(a==ok) return true; if(visited[y][x]) return false; visited[y][x]=true; for(int i=0;i<4;i++){ int cx=x+mx[i],cy=y+my[i]; if(cx<0||3> a(4,vector(4)); int x,y; for(int i=0;i<4;i++){ for(int j=0;j<4;j++){ cin>>a[i][j]; if(a[i][j]==0) x=j,y=i; } } if(dfs(a,x,y)) cout<<"Yes"<