from collections import deque import copy dist = {} x = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0) goal = set() goal.add(x) x = list(x) x = [[x[i],0] for i in range(16)] que = deque([x]) while que: x = que.popleft() x1 = tuple([x[i][0] for i in range(16)]) # print(x1) ind = x.index([0,0]) h = ind//4 w = ind%4 for dh,dw in [(0,1),(0,-1),(1,0),(-1,0)]: nh = h+dh nw = w+dw if 0<=nh<4 and 0<=nw<4: y = copy.deepcopy(x) ind1 = nh*4+nw if y[ind1][1]==0: y[ind],y[ind1] = y[ind1],y[ind] y[ind][1] = 1 z = tuple([y[i][0] for i in range(16)]) goal.add(z) que.append(y) y = [] for i in range(4): y += list(map(int,input().split())) y = tuple(y) if y in goal: print("Yes") else: print("No")