#include #define MOD 1000000007 #define INF (1<<30) #define INFL (1<<62) #define pe(str) return cout<<(str)<=0;i--) #define rep(i,a,b) for(int i=(a);i<(b);i++) #define rrep(i,a,b) for(int i=(b);i>=(a);i--) #define bw(a,b,c) (((a)<=(b))&&((b)<=(c))) #define hello cout<<"hello"<>n #define EPS 1e-6 #define EPSIN(a,b) ((b)-EPS<=(a)&&(a)<=(b)+EPS) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair pii; typedef complex point; template void dump(InputIterator first,InputIterator last,char delim=' '){ for(InputIterator it=first;it!=last;it++){ if(it!=first)cout< void swp(T &a,T &b){ T t=a; a=b; b=t; } int c[4][4]; int s=0; int x,y; void dfs(int i,int j){ if(!(bw(0,i,4)&&bw(0,j,4)))return; if(c[i][j]!=1)return; c[i][j]=0; dfs(i+1,j); dfs(i-1,j); dfs(i,j-1); dfs(i,j+1); } int main(void){ int a[4][4]; int b[4][4]={ {1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,0} }; re(i,4) re(j,4) cin>>a[i][j]; re(i,4){ re(j,4){ re(k,4){ re(l,4){ if(a[i][j]==b[k][l]){ c[i][j]=abs(i-k)+abs(j-l); if(a[i][j]!=0&&abs(i-k)+abs(j-l)>=2)pe("No"); if(c[i][j]==1)s++; if(a[i][j]==0){x=i;y=j;c[i][j]=1;} goto B; } } } B:; } } // re(i,4){ // dump(c[i],c[i]+4); // cout<