We have a 3 \times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left.   According to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) is equal to a_i + b_j.   Determine if he is correct.
grid = [list(map(int, input().split())) for _ in range(3)]

# Row's check
diff1 = grid[1][0] - grid[0][0]
diff2 = grid[2][0] - grid[0][0]

flag = False

row1 = grid[0]
row2 = grid[1]
row3 = grid[2]

row1_  = [c + diff1 for c in row1]
row1__ = [c + diff2 for c in row2]

if row1_ == row2 and row1__ == row3:
    flag = True

if flag:
    print("Yes")

else:
    print("No")

c = []

for i in range(3):
    A = list(map(int, input().split()))
    c.append(A)
if c[0][0] + c[1][1]+ c[2][2] == c[1][0] + c[2][1] + c[0][2] == c[2][0] + c[0][1] + c[1][2]:
    print('Yes')
else:
    print('No')