#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iostream>
#include <queue>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;

bool ret;

int vx[4] = {1,-1,0,0};
int vy[4] = {0,0,1,-1};

void dfs(vector< vector<int> >& v, vector<int>& used){
  if(ret) return;
  bool flg = true;
  int zi, zj;
  rep(i,4){
    rep(j,4){
      if(i==3 && j==3) continue;
      if(v[i][j] != 4*i+j+1) flg = false;
      if(v[i][j] == 0){
        zi = i;
        zj = j;
      }
    }
  }
  if(flg){
    ret = true;
    return;
  }

  rep(k,4){
    int ny = zi + vy[k];
    int nx = zj + vx[k];
    if(0<=nx&&nx<4 && 0<=ny&&ny<4 && used[v[ny][nx]]==0){
      int val = v[ny][nx];
      used[val] = 1;
      swap(v[zi][zj], v[ny][nx]);

      dfs(v, used);
      
      swap(v[zi][zj], v[ny][nx]);
      used[val] = 0;
    }
  }

}

int main(){
  vector< vector<int> > v(4, vector<int>(4, 0));
  rep(i,4){
    rep(j,4){
      cin >> v[i][j];
    }
  }
  
  vector<int> used(20,0);

  ret = false;
  dfs(v, used);
  if(ret){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
  return 0;
}