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.
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans='Yes'
if a[1]-a[0]!=b[1]-b[0] or a[2]-a[1]!=b[2]-b[1]:
  ans='No'
elif b[0]-a[0]!=b[1]-a[1] or  b[2]-a[2]!=b[1]-a[1]:
  ans='No'
elif c[0]!=a[2]+b[0] or c[1]!=a[2]+b[1] or c[2]!=a[2]+b[2]:
  ans='No'
print(ans)
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans='No'
if a[1]-a[0]==b[1]-b[0]==c[1]-c[0] and a[2]-a[1]==b[2]-b[1]==c[2]-c[1]:
  if b[0]-a[0]==b[1]-a[1]==b[2]-a[2] and c[0]-b[0]==c[1]-b[1]==c[2]-b[2]:
    ans='Yes'
print(ans)
