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.
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= []
l = []
f = 0
def say(i):return print("Yes" if i == 0 else "No")
def Say(i):return print("YES" if i == 0 else "NO")

def addarray(k,l):
    for i in range(n):
        a ,b = map(int,input().split())
        w.append(b)
        v.append(a)

for i in range(3):
    k.append(lma())
a = k[0][0]//2 if k[0][0]%2 == 0 else  -1
b = k[1][1]//2 if k[1][1]%2 == 0 else  -1
c = k[2][2]//2 if k[2][2]%2 == 0 else  -1
if k[0][1] == a+b and k[1][0] == a+b and k[0][2] == a + c and k[2][0] == a + c and k[2][1] == b + c and k[1][2] == b + c:
    print("Yes")
else:print("No")


import copy
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= []
l = []
for i in range(3):
    k.append(lma())
l = copy.deepcopy(k)
p = copy.deepcopy(k)

for i in range(1,3):
    for j in range(0,3):
        l[i][j] -= k[i-1][j]
        p[j][i] -= k[j][i-1]
if l[1][0]==l[1][1] and l[1][1]==l[1][2] and l[2][0]==l[2][1] and l[2][1]==l[2][2] and p[0][1] == p[1][1] and p[2][1] == p[1][1] and p[2][2] == p[1][2] and p[0][2]==p[1][2]:
    print("Yes")
else:print("No")


