import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines *A, = map(int,read().split()) def dist(i,j): xi,yi = divmod(i,4) xj,yj = divmod(j,4) return abs(xi-xj) + abs(yi-yj) while True: zero = A.index(0) if zero == 15: break target = A.index(zero+1) if dist(zero, target) > 1: break A[zero], A[target] = A[target], A[zero] B = list(range(1,16)) + [0] answer = 'Yes' if A == B else 'No' print(answer)