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 = []
for i in range(3):
    grid.append([int(i) for i in input().split()])

for _ in range(100):
    a1 = i
    b1 = grid[0][0] - a1
    b2 = grid[0][1] - a1
    b3 = grid[0][2] - a1
    if  grid[1][0] - b1 == grid[1][1] - b2 == grid[1][2] - b3 and grid[2][0] - b1 == grid[2][1] - b2 == grid[2][2] - b3:
        print('Yes')
        break

print('No')

grid = []
for i in range(3):
    grid.append([int(i) for i in input().split()])

for _ in range(100):
    a1 = i
    b1 = grid[0][0] - a1
    b2 = grid[0][1] - a1
    b3 = grid[0][2] - a1
    if  grid[1][0] - b1 == grid[1][1] - b2 == grid[1][2] - b3 and grid[2][0] - b1 == grid[2][1] - b2 == grid[2][2] - b3:
        print('Yes')
        exit()
print('No')
