import java.io.*; import java.util.*; import java.math.*; class Main { static int size = 4 , max = 15; static int[][] in = new int[size][size]; static int[][] board = {{ 1, 2, 3, 4}, { 5, 6, 7, 8}, { 9,10,11,12}, {13,14,15, 0}}; static int[] dx = {0,0,-1,1}; static int[] dy = {-1,1,0,0}; static boolean[] isMoved = new boolean[max + 1]; public static void out (Object o) { System.out.println(o); } public static boolean compArray () { for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { if (in[i][j] != board[i][j]) return false; } } return true; } public static boolean solve (int x , int y) { if (compArray()) return true; for (int i = 0; i < size; i++) { int moveX = x + dx[i]; int moveY = y + dy[i]; if (moveX < 0 || moveX >= size || moveY < 0 || moveY >= size) continue; int n = board[moveY][moveX]; if (isMoved[n]) continue; isMoved[n] = true; board[moveY][moveX] = 0; board[y][x] = n; if (solve(moveX , moveY)) return true; isMoved[n] = false; board[moveY][moveX] = n; board[y][x] = 0; } return false; } public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); for (int i = 0; i < size; i++) { String[] line = br.readLine().split(" "); for (int j = 0; j < size; j++) { in[i][j] = Integer.parseInt(line[j]); } } out(solve(size - 1 , size - 1) ? "Yes" : "No"); } }