ls = [] for i in range(4): ls += list(map(int,input().split())) ls = tuple(ls) kls = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0] moveto = [-4,-1,1,4] als = set() def dfs(ls0): als.add(tuple(ls0)) ind0 = ls0.index(0) if ind0 + 4 < 16: if ls0[ind0+4] == ind0+5: ls1 = ls0[:] ls1[ind0],ls1[ind0+4] = ls1[ind0+4],ls1[ind0] dfs(ls1) if ind0 - 4 >= 0: if ls0[ind0-4] == ind0-3: ls1 = ls0[:] ls1[ind0],ls1[ind0-4] = ls1[ind0-4],ls1[ind0] dfs(ls1) if ind0 % 4 != 0: if ls0[ind0-1] == ind0: ls1 = ls0[:] ls1[ind0],ls1[ind0-1] = ls1[ind0-1],ls1[ind0] dfs(ls1) if ind0 % 4 != 3: if ls0[ind0+1] == ind0: ls1 = ls0[:] ls1[ind0],ls1[ind0+1] = ls1[ind0+1],ls1[ind0] dfs(ls1) dfs(kls) print('Yes' if ls in als else 'No')