#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; 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],a[i][j]--,b[i][j]--; re(i,4) re(j,4) if(a[i][j]==-1){x=i,y=j;goto A;} A:; re(i,4) re(j,4){ if(bw(0,x-1,3)&&bw(0,y,3)&&a[x-1][y]==x*4+y){swap(a[x][y],a[x-1][y]);x=x-1;y=y;continue;} if(bw(0,x+1,3)&&bw(0,y,3)&&a[x+1][y]==x*4+y){swap(a[x][y],a[x+1][y]);x=x+1;y=y;continue;} if(bw(0,x,3)&&bw(0,y-1,3)&&a[x][y-1]==x*4+y){swap(a[x][y],a[x][y-1]);x=x;y=y-1;continue;} if(bw(0,x,3)&&bw(0,y+1,3)&&a[x][y+1]==x*4+y){swap(a[x][y],a[x][y+1]);x=x;y=y+1;continue;} goto B; } B:; re(i,4) re(j,4) if(a[i][j]!=b[i][j])pe("No"); pe("Yes"); return 0; }