A = []
B = []
C = []
for k in range(4):
A.append([0] * 4)
B.append([0] * 4)
C.append([0] * 4)
for i in range(4):
for j in range(4):
A[i][j] = int(input())
for a in range(4):
for b in range(4):
B[a][b] = int(input())
for t in range(4):
for g in range(4):
if A[t][g] == B[t][g]:
C[t][g] = A[t][g]
else:
C[t][g] = A[t][g] + B[t][g]
print(C)
A = []
B = []
C = []
for k in range(4):
A.append([0] * 4)
B.append([0] * 4)
C.append([0] * 4)
for i in range(4):
for j in range(4):
A[i][j] = int(input())
for a in range(4):
for b in range(4):
B[a][b] = int(input())
for t in range(4):
for g in range(4):
if A[t][g] == B[t][g]:
C[t][g] = A[t][g]
else:
C[t][g] = A[t][g] + B[t][g]
print(C)