#include #define ll long long #define INF 1000000005 #define MOD 1000000007 #define EPS 1e-10 #define rep(i,n) for(int i=0;i<(int)n;++i) #define each(a, b) for(auto (a): (b)) #define all(v) (v).begin(),(v).end() #define fi first #define se second #define pb push_back #define show(x) cout <<#x<<" = "<<(x)<P; const int MAX_N = 16; vector > mp(4,vector

(4,P(0,0))); int dx[] = {-1,1,0,0}; int dy[] = {0,0,-1,1}; bool check() { rep(i,4){ rep(j,4){ if(i == 3 && j == 3){ if(mp[i][j].fi != 0){ return false; } }else{ if(4*i+j+1 != mp[i][j].fi){ return false; } } } } return true; } bool dfs(int u,int v) { if(check()){ return true; } bool res = false; rep(i,4){ int nu = u + dx[i]; int nv = v + dy[i]; if(nu >= 0 && nu < 4 && nv >= 0 && nv < 4 && mp[nu][nv].se == 0){ P bf = mp[nu][nv]; mp[nu][nv] = P(0,0); mp[u][v] = P(bf.fi,1); res = dfs(nu,nv); mp[u][v] = P(0,0); mp[nu][nv] = bf; } if(res){ break; } } return res; } int main() { int zi,zj; rep(i,4){ rep(j,4){ int a; cin >> a; if(a == 0){ zi = i,zj = j; } mp[i][j] = P(a,0); } } if(dfs(zi,zj)){ cout << "Yes\n"; }else{ cout << "No\n"; } return 0; }