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.  

-----Constraints-----
 - c_{i, j} \ (1 \leq i \leq 3, 1 \leq j \leq 3) is an integer between 0 and 100 (inclusive).

-----Input-----
Input is given from Standard Input in the following format:
c_{1,1} c_{1,2} c_{1,3}
c_{2,1} c_{2,2} c_{2,3}
c_{3,1} c_{3,2} c_{3,3}

-----Output-----
If Takahashi's statement is correct, print Yes; otherwise, print No.

-----Sample Input-----
1 0 1
2 1 2
1 0 1

-----Sample Output-----
Yes

Takahashi is correct, since there are possible sets of integers such as: a_1=0,a_2=1,a_3=0,b_1=1,b_2=0,b_3=1.

Difficulty: introductory

Starter code:

Solutions:
#!/usr/bin/env python3

c = [list(map(int, input().split())) for i in range(3)]


a1 = 0
b1, b2, b3 = c[0][0], c[0][1], c[0][2]
a2 = c[1][0]-b1
a3 = c[2][0]-b1

check = []
check.append(c[1][1] == a2+b2)
check.append(c[2][1] == a3+b2)
check.append(c[1][2] == a2+b3)
check.append(c[2][2] == a3+b3)

if sum(check) == 4:
    print("Yes")
else:
    print("No")


c11, c12, c13 = map(int, input().split())
c21, c22, c23 = map(int, input().split())
c31, c32, c33 = map(int, input().split())

if c21-c11==c22-c12==c23-c13 and c31-c21==c32-c22==c33-c23 and c12-c11==c22-c21==c32-c31 and c13-c12==c23-c22==c33-c32:
    print("Yes")
else:
    print("No")

import numpy as np
C = np.array([[int(x) for x in input().split()] for _ in range(3)])
ans = 'Yes'
for i in range(2):
    if not(C[0,i+1]-C[0,i] == C[1,i+1]-C[1,i] == C[2,i+1]-C[2,i]):
        ans = 'No'
    if not(C[i+1,0]-C[i,0] == C[i+1,1]-C[i,1] == C[i+1,2]-C[i,2]):
        ans = 'No'
print(ans)


A1 = 0
B1, B2, B3 = map(int, input().split())
C1, C2, C3 = map(int, input().split())
D1, D2, D3 = map(int, input().split())
flag = 0
if not( C2-B2 == C1-B1 and C3-B3 == C1-B1 and C2-B2 == C3-B3):
    flag = 1
if not( D2-B2 == D1-B1 and D3-B3 == D1-B1 and D2-B2 == D3-B3):
    flag = 1
print("Yes" if flag == 0 else "No")

C=[list(map(int,input().split())) for i in range(3)]
Bs=[C[0][i] for i in range(3)]
As=[0,C[1][0]-Bs[0],C[2][0]-Bs[0]]
if all(As[i]+Bs[j]==C[i][j] for i in range(3) for j in range(3)):
    print("Yes")
else:
    print("No")

c = []
for i in range(3):
    c.append(list(map(int, input().split())))

ans = True
for i in range(2):
    tmp = c[0][i + 1] - c[0][i]
    for j in range(2):
        if c[j + 1][i + 1] - c[j + 1][i] != tmp:
            ans = False
            break

for i in range(2):
    tmp = c[i + 1][0] - c[i][0]
    for j in range(2):
        if c[i + 1][j + 1] - c[i][j + 1] != tmp:
            ans = False
            break

if ans:
    print("Yes")
else:
    print("No")


with open(0) as f:
    C = [list(map(int, line.split())) for line in f.readlines()]
b = [(C[i][1]-C[i][0], C[i][2]-C[i][1]) for i in range(3)]
a = [(C[1][j]-C[0][j], C[2][j]-C[1][j]) for j in range(3)]
print('Yes' if a[0]==a[1]==a[2] and b[0]==b[1]==b[2] else 'No')

a,b,c = map(int,input().split())
d,e,f = map(int,input().split())
g,h,i = map(int,input().split())

if a+e+i == b+f+g == c+d+h == a+f+h == c+e+g == b+d+i:
  print("Yes")
else:
  print("No")

c = [list(map(int, input().split())) for _ in range(3)]
A1 = c[1][0] - c[0][0]
A2 = c[2][0] - c[1][0]
B1 = c[0][1] - c[0][0]
B2 = c[0][2] - c[0][1]
if c[1][1] == A1 + B1 + c[0][0] and c[1][2] == A1 + B1 + B2 + c[0][0] and c[2][1] == A1 + A2 + B1 + c[0][0] and c[2][2] == A1 + A2 + B1 + B2 + c[0][0]:
    print("Yes")
else:
    print("No")

c = [list(map(int, input().split())) for _ in range(3)]

if sum([sum(i) for i in c]) % 3 != 0:
    print("No")
else:
    a0 = 0
    b0, b1, b2 = c[0][0], c[0][1], c[0][2]
    a1, a2 = c[1][0] - b0, c[2][0] - b0
    if c[1][1] == a1 + b1 and c[1][2] == a1 + b2 and c[2][1] == a2 + b1 and c[2][2] == a2 + b2:
        print("Yes")
    else:
        print("No")


def LIHW(h):
    return [list(map(int, input().split())) for _ in range(h)]
 
 
masu = LIHW(3)
ans = "Yes"
for i in range(2):
    if masu[i+1][1]-masu[i+1][0] != masu[0][1]-masu[0][0]:
        ans = "No"
    if masu[i+1][2]-masu[i+1][1] != masu[0][2]-masu[0][1]:
        ans = "No"
for i in range(2):
    if masu[1][i+1]-masu[0][i+1] != masu[1][0]-masu[0][0]:
        ans = "No"
    if masu[2][i+1]-masu[1][i+1] != masu[2][0]-masu[1][0]:
        ans = "No"
print(ans)

c=[]
for _ in range(3):
    c.append(list(map(int,input().split())))

s=0
for i in range (3):
    for j in range(3):
        if i==j:
            s+=c[i][j]*2
        else:s-=c[i][j]

if s==0:print("Yes")
else:print("No")


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


r1 = list(map(int, input().split()))
r2 = list(map(int, input().split()))
r3 = list(map(int, input().split()))
a = [0]*3
b = [0]*3
for i in range(101):
  a[0] = i
  for j in range(3):
    b[j] = r1[j]-a[0]
    
  a[1] = r2[0] - b[0]
  a[2] = r3[0] - b[0]

  flag = False
  for j in range(3):
    if r1[j]==a[0]+b[j] and r2[j]==a[1]+b[j] and r3[j] == a[2]+b[j]:
      flag = True
    else:
      flag = False
      break
  if flag:
    break
    
print("Yes") if flag else print("No")

x=list(map(int, input().split()))
y=list(map(int, input().split()))
z=list(map(int, input().split()))
if x[1]-x[0] != y[1]-y[0] or y[1]-y[0] != z[1]-z[0] or x[2]-x[0] != y[2]-y[0] or y[0]-x[0] !=y[1]-x[1] or z[1]-x[1] !=z[2]-x[2] or z[0]-x[0] !=z[1]-x[1] or z[1]-x[1] !=z[2]-x[2] :
    print('No')
else:
    print('Yes')

def is_valid(m, a, b):
    for i in range(3):
        for j in range(3):
            if (m[i][j] != a[i] + b[j]):
                return 0
    return 1


m = []
for a0 in range(3):
    m.append(list(map(int, input().split())))

for a0 in range(101):
    b0 = m[0][0] - a0
    b1 = m[0][1] - a0
    b2 = m[0][2] - a0
    a1 = m[1][0] - b0
    a2 = m[2][0] - b0
    if (is_valid(m, [a0, a1, a2], [b0, b1, b2])):
        print("Yes")
        return
print("No")


List=[list(map(int,input().split())) for i in range(3)]
newlist=[]
new = [x-y for (x,y) in zip(List[0],List[1])]
new2 = [x-y for (x,y) in zip(List[2],List[1])]
if new[0]==new[1] and new[1]==new[2]:
    pass
else:
    print('No')
    return
if new2[0]==new2[1] and new2[1]==new2[2]:
    pass
else:
    print('No')
    return
    
if List[0][0]-List[0][1]==List[1][0]-List[1][1] and List[2][0]-List[2][1]==List[1][0]-List[1][1]:
    pass
else:
    print('No')
    return
if List[0][0]-List[0][2]==List[1][0]-List[1][2] and List[2][0]-List[2][2]==List[1][0]-List[1][2]:
    pass
else:
    print('No')
    return
print('Yes')

a,b,c = map(int,input().split())
d,e,f = map(int,input().split())
g,h,i = map(int,input().split())
 
if a+e+i == b+f+g == c+d+h:
  print("Yes")
else:
  print("No")

# -*- coding: utf-8 -*-
import numpy as np

# worst order: 101^6 => 10^8

c = []
c.append(list(map(int, input().split())))
c.append(list(map(int, input().split())))
c.append(list(map(int, input().split())))

arr_c = np.array(c)
a_max = np.amax(arr_c, axis=1)
b_max = np.amax(arr_c, axis=0)

a = []
b = []
for i in range(3):
    if len(list(range(0, a_max[i]+1, 1)))==0:
        a.append([0])
    else:
        a.append(list(range(0, a_max[i]+1, 1)))
    
    if len(list(range(0, b_max[i]+1, 1)))==0:
        b.append([0])
    else:
        b.append(list(range(0, b_max[i]+1, 1)))

ans = 'No'
cnt = 0
for a0 in a[0]:
    for b0 in b[0]:
        if c[0][0] != a0 + b0:
            continue
        for a1 in a[1]:
            if c[1][0] != a1 + b0:
                continue
            for b1 in b[1]:
                if c[0][1] != a0 + b1 or c[1][1] != a1 + b1:
                    continue   
                for a2 in a[2]:
                    if c[2][0] != a2 + b0 or c[2][1] != a2 + b1:
                        continue
                    for b2 in b[2]:
                        if c[0][2] != a0 + b2 or c[1][2] != a1 + b2 or c[2][2] != a2 + b2:
                            continue

                        print("Yes")
                        return

print(ans)

c = [list(map(int, input().split())) for _ in range(3)]

for i in range(1, 3):
    d = c[i][0] - c[0][0]
    e = c[0][i] - c[0][0]
    for j in range(1, 3):
        if d != c[i][j] - c[0][j]:
            print("No")
            return
        if e != c[j][i] - c[j][0]:
            print("No")
            return
print("Yes")

c11 ,c12, c13 = map(int,input().split())
c21 ,c22, c23 = map(int,input().split())
c31 ,c32, c33 = map(int,input().split())

if c11 - c12 == c21 -c22 == c31-c32 and c12 - c13 == c22 -c23 == c32-c33 and c11 - c21 == c12 -c22 == c13-c23 and c21 - c31 == c22 -c32 == c23-c33 :
    print('Yes')
else :
    print('No')

clst=list(map(int,input().split()))
dif=[x-clst[0] for x in clst]
clst=list(map(int,input().split()))
if not [clst[0]+x for x in dif]==clst : print("No");return
clst=list(map(int,input().split()))
if not [clst[0]+x for x in dif]==clst : print("No");return
print("Yes")

a=[list(map(int,input().split())) for _ in range(3)]
b=list(zip(*a))
c=a[0]
d=b[0]
f=True

dx1=c[1]-c[0]
dx2=c[2]-c[1]
dy1=d[1]-d[0]
dy2=d[2]-d[1]

for i in range(3):
  c=a[i]
  d=b[i]
  if dx1==c[1]-c[0] and dx2==c[2]-c[1] and dy1==d[1]-d[0] and dy2==d[2]-d[1]:
    f=True
  else:
    f=False
    break
if f:
  print('Yes')
else:
  print('No')

c11,c12,c13=list(map(int, input().split()))
c21,c22,c23=list(map(int, input().split()))
c31,c32,c33=list(map(int, input().split()))

ans="No"
for a1 in range(c11+1):
    
    b1=c11-a1
    b2=c12-a1
    b3=c13-a1
    a2=c21-b1
    a3=c31-b1

    if c22==a2+b2 and c23==a2+b3 and c32==a3+b2 and c33==a3+b3:
        ans="Yes"
        break

print(ans)


c=[list(map(int,input().split())) for _ in range(3)]
for i in range(2):
    if not (c[i+1][0]-c[i][0]==c[i+1][1]-c[i][1] and c[i+1][1]-c[i][1]==c[i+1][2]-c[i][2]):
        print("No")
        break
    if not (c[0][i+1]-c[0][i]==c[1][i+1]-c[1][i] and c[1][i+1]-c[1][i]==c[2][i+1]-c[2][i]):
        print("No")
        break
else:
    print("Yes")


C = [list(map(int, input().split())) for _ in range(3)]
x = [0, 0, 0]
y = [0, 0, 0]

for i in range(3):
    y[i] = C[0][i]
for i in range(3):
    x[i] = C[i][0] - y[0]
for i in range(3):
    for j in range(3):
        if C[i][j] != x[i] + y[j]:
            print('No')
            return
print('Yes')

c = [list(map(int, input().split())) for _ in range(3)]

a = [0, 0, 0]
b = [0, 0, 0]

def check(c, a, b):
    for i in range(3):
        for j in range(3):
            if a[i] + b[j] != c[i][j]:
                return False
    return True

for i in range(101):
    b[0] = i
    a[0] = c[0][0] - b[0]
    a[1] = c[1][0] - b[0]
    a[2] = c[2][0] - b[0]
    b[1] = c[0][1] - a[0]
    b[2] = c[0][2] - a[0]

    if check(c, a, b):
        print("Yes")
        return

print("No")


# -*- coding: utf-8 -*-
import numpy as np

# worst order: 101^6 => 10^8

def check(a, b, c):
    flag = True
    for i in range(3):
        for j in range(3):
           if c[i][j]!=a[i]+b[j]:
               flag = False
               return flag

    return flag

c = []
c.append(list(map(int, input().split())))
c.append(list(map(int, input().split())))
c.append(list(map(int, input().split())))

arr_c = np.array(c)
a_max = np.amax(arr_c, axis=1)
b_max = np.amax(arr_c, axis=0)

a = []
b = []
for i in range(3):
    if len(list(range(0, a_max[i]+1, 1)))==0:
        a.append([0])
    else:
        a.append(list(range(0, a_max[i]+1, 1)))
    
    if len(list(range(0, b_max[i]+1, 1)))==0:
        b.append([0])
    else:
        b.append(list(range(0, b_max[i]+1, 1)))

ans = 'No'
cnt = 0
for a0 in a[0]:
    for b0 in b[0]:
        if c[0][0] != a0 + b0:
            continue
        for a1 in a[1]:
            if c[1][0] != a1 + b0:
                continue
            for b1 in b[1]:
                if c[0][1] != a0 + b1 or c[1][1] != a1 + b1:
                    continue   
                for a2 in a[2]:
                    if c[2][0] != a2 + b0 or c[2][1] != a2 + b1:
                        continue
                    for b2 in b[2]:
                        if c[0][2] != a0 + b2 or c[1][2] != a1 + b2 or c[2][2] != a2 + b2:
                            continue

                        print("Yes")
                        return

print(ans)

# -*- coding: utf-8 -*-

c = [list(map(int, input().split())) for _ in range(3)]

a = [0] * 3
b = [0] * 3

for j in range(3):
    b[j] = c[0][j] - a[0]

for i in range(1,3,1):
    a[i] = c[i][0] - b[0]

for i in range(3):
    for j in range(3):
        if c[i][j] != a[i] + b[j]:
            print("No")
            return

print("Yes")


c = [0] * 3
for i in range(3):
    c[i] = list(map(int, input().split()))

if c[2][1] - c[2][0] == c[0][1] - c[0][0] and c[0][2] - c[1][2] == c[0][0] - c[1][0] and c[1][2] - c[2][2] == c[1][0] - c[2][0] and c[0][2] - c[2][2] == c[0][0] - c[2][0] and c[1][1] - c[0][1] == c[1][0] - c[0][0]:
    print("Yes")
else:
    print("No")

c = [list(map(int,input().split())) for _ in range(3)]
a = [0]*3
b = [0]*3
ok = True

b = c[0]

a[1] = c[1][0]-b[0]
a[2] = c[2][0]-b[0]

for i in range(3):
    for j in range(3):
        if c[i][j]!=a[i]+b[j]:
            ok = False
        
if ok:
    print('Yes')
else:
    print('No')


c = [list(map(int, input().split())) for _ in range(3)]
ans = "Yes"
for i in range(1,3):
    if c[i][0]-c[0][0] != c[i][1]-c[0][1] or c[i][1]-c[0][1] != c[i][2]-c[0][2]:
        ans = "No"
print(ans)

ans = 'Yes'
c = []
for _ in range(3):
  c.append(list(map(int, input().split())))
adiff = []
bdiff = []
for i in range(2):
  adiff.append(c[i+1][0] - c[i][0])
  bdiff.append(c[0][i+1] - c[0][i])
for i in range(1, 3):
  for j in range(1, 3):
    if adiff[i-1] != c[i][j] - c[i-1][j] or bdiff[j-1] != c[i][j] - c[i][j-1]:
      ans = 'No'
      break
print(ans)


a,b,c=[list(map(int,input().split())) for i in range(3)]
print("Yes" if (a[0]-a[1],a[1]-a[2],a[0]-a[1])==(b[0]-b[1],b[1]-b[2],b[0]-b[1])==(c[0]-c[1],c[1]-c[2],c[0]-c[1]) else "No")

c = [list(map(int,input().split())) for i in range(3)]
x = [0] * 3
y = [0] * 3
for i in range(3):
    y[i] = c[0][i] - x[0]
for i in range(3):
    x[i] = c[i][0] - y[0]

flag = True
for i in range(3):
    for j in range(3):
        if x[i] + y[j] != c[i][j]:
            flag = False
if flag:
    print("Yes")
else:
    print("No")

c = [list(map(int, input().split())) for _ in range(3)]
for i in [1, 2]:
  d1 = c[0][0] - c[i][0]
  d2 = c[0][1] - c[i][1]
  d3 = c[0][2] - c[i][2]
  d4 = c[0][0] - c[0][i]
  d5 = c[1][0] - c[1][i]
  d6 = c[2][0] - c[2][i]
  if d1 != d2 or d1 != d3 or d4 != d5 or d4 != d6:
    print("No")
    return
print("Yes")

arr = []

for _ in range(3):
    arr += list(map(int, input().split()))

a = [0] * 3
b = [0] * 3
a[0] = 0
b[0] = arr[0]
b[1] = arr[1]
b[2] = arr[2]
a[1] = arr[4] - b[1]
a[2] = arr[8] - b[2]

tmp = [a[i] + b[j] for i in range(3) for j in range(3)]

print('Yes' if arr == tmp else 'No')

field=[]
result="Yes"
for i in range(3):
  field.append(list(map(int,input().split())))
for i in range(3):
  for j in range(3):
    if not (field[i][j]>=0 and field[i][j]<=100*2):
      result="No"
    if j ==0:
      pos_i0=field[i][j]
    field[i][j]-=pos_i0
for j in range(3):
  if not (field[0][j]==field[1][j] and field[0][j]==field[2][j]):
    result="No"
print(result)

def main():
    c1 = list(map(int, input().split()))
    c2 = list(map(int, input().split()))
    c3 = list(map(int, input().split()))
    for i in range(0, 101):
        for j in range(0, 101):
            for k in range(0, 101):
                flag = True
                b = []
                for l in range(3):
                    b.append(c3[l] - k)
                for l in range(3):
                    if j+b[l] != c2[l]:
                        flag = False
                        break
                for l in range(3):
                    if i+b[l] != c1[l]:
                        flag = False
                        break
                if flag:
                    print('Yes')
                    return

    print('No')

def __starting_point():
    main()

__starting_point()

# -*- coding: utf-8 -*-
"""
Created on Tue Sep 22 04:07:05 2020

@author: liang
"""

C = [[int (x) for x in input().split()] for _ in range(3)]
A = [0]*3
B = [0]*3

ans = False
for a1 in range(C[0][0]+1):
    tmp = True
    b1 = C[0][0] - a1
    b2 = C[0][1] - a1
    b3 = C[0][2] - a1
    a2 = C[1][0] - b1
    a3 = C[2][0] - b1
    if C[1][1] != a2+b2:
        tmp = False
    if C[1][2] != a2+b3:
        tmp = False
    if C[2][1] != a3+b2:
        tmp = False
    if C[2][2] != a3+b3:
        tmp = False
    if tmp == True:
        ans = True
if ans:
    print("Yes")
else:
    print("No")

# coding: utf-8


def main():
    ans = 'No'
    c = [list(map(int, input().split())) for _ in range(3)]
    for i in range(101):
        for j in range(101):
            for k in range(101):
                flgs = [False, False, False]
                if c[0][0] - i == c[1][0] - j and c[0][0] - i == c[2][0] - k: flgs[0] = True
                if c[0][1] - i == c[1][1] - j and c[0][1] - i == c[2][1] - k: flgs[1] = True
                if c[0][2] - i == c[1][2] - j and c[0][2] - i == c[2][2] - k: flgs[2] = True
                if (all(flgs)): ans = 'Yes'

    print(ans)

def __starting_point():
    main()

__starting_point()

from sys import stdin, stdout # only need for big input


def solve():
    c1 = list(map(int, input().split()))
    c2 = list(map(int, input().split()))
    c3 = list(map(int, input().split()))
    b = c1
    a2 = [c2[i] - b[i] for i in range(3)]
    a3 = [c3[i] - b[i] for i in range(3)]
    if max(a2) == min(a2) and max(a3) == min(a3):
        print("Yes")
    else:
        print("No")

def main():
    solve()


def __starting_point():
    main()
__starting_point()

c = [list(map(int,input().split())) for _ in range(3)]

check = False
for i in range(101):
  for j in range(101):
    for k in range(101):
      o = c[0][0] - i
      p = c[1][1] - j
      q = c[2][2] - k
      
      if o < 0 or p < 0 or q < 0:
        continue
      
      ls = [[i+o,i+p,i+q],[j+o,j+p,j+q],[k+o,k+p,k+q]]
      if ls == c:
        check = True
        break
        
print("Yes" if check else "No")

def main():
  c=[list(map(int,input().split())) for _ in [0,0,0]]
  for j in [2,1,0]:
    if c[j][0]-c[j-1][0]==c[j][1]-c[j-1][1]==c[j][2]-c[j-1][2]:
      continue
    if c[0][j]-c[0][j-1]==c[1][j]-c[1][j-1]==c[2][j]-c[2][j-1]:
      continue
    print("No")
    return
  print("Yes")
  return
main()

List = []
for i in range (3):
  List.append(list(map(int, input().split())))
a = 0
b = 0
c = 0
flg = True
for i in range(2):
  a = List[0][i+1] - List[0][i]
  b = List[1][i+1] - List[1][i]
  c = List[2][i+1] - List[2][i]
  if a != b or b != c or c != a:
    flg = False
  a = List[i+1][0] - List[i][0]
  b = List[i+1][1] - List[i][1]
  c = List[i+1][2] - List[i][2]
  if a != b or b != c or c != a:
    flg = False
if flg:
  print("Yes")
else:
  print("No")

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

c = []
for _ in range(3):
  c.append(list(map(int, input().split())))
if c[0][1]-c[0][0] == c[1][1]-c[1][0] and c[2][1]-c[2][0] == c[1][1]-c[1][0] and c[0][2]-c[0][1] == c[1][2]-c[1][1] and c[2][2]-c[2][1] == c[1][2]-c[1][1]:
  print("Yes")
else:
  print("No")

L = [list(map(int, input().split())) for _ in range(3)]
T = sum([sum(i) for i in L])
print('Yes' if L[0][0] + L[1][1] + L[2][2] == (T / 3) else 'No')

c=[list(map(int,input().split())) for _ in range(3)]

ans = "Yes"

for i in range(2):
    if c[i+1][1]-c[i+1][0] != c[0][1]-c[0][0]:
        ans = "No"
    if c[i+1][2]-c[i+1][1] != c[0][2]-c[0][1]:
        ans = "No"
for j in range(2):
    if c[1][i+1]-c[0][i+1] != c[1][0]-c[0][0]:
        ans = "No"
    if c[2][i+1]-c[1][i+1] != c[2][0]-c[1][0]:
        ans = "No"

print(ans)

c = [list(map(int, input().split())) for _ in range(3)]
# a2 + b1 = c21
# a2 + b2 = c22
# a2 + b3 = c23
b1, b2, b3 = c[0][0], c[0][1], c[0][2]

if c[1][0] - b1 == c[1][1] - b2 == c[1][2] - b3 and c[2][0] - b1 == c[2][1] - b2 == c[2][2] - b3:
    print('Yes')
else:
    print('No')


c1 = list(map(int, input().split()))
c2 = list(map(int, input().split()))
c3 = list(map(int, input().split()))
c = [c1,c2,c3]
for a1 in range(100):
    b1 = c1[0] - a1
    b2 = c1[1] - a1
    b3 = c1[2] - a1
    a21 = c2[0] - b1
    a22 = c2[1] - b2
    a23 = c2[2] - b3
    a31 = c3[0] - b1
    a32 = c3[1] - b2
    a33 = c3[2] - b3
#     print('a1',a1)
#     print('a2',a21,a22,a23)
#     print('a3',a31,a32,a33)
#     print('b',b1,b2,b3)
    if (a21 == a22 == a23) and (a31 == a32 == a33):
        print('Yes')
        break
    elif a1 == 99:
        print('No')
        break
    else:
        continue

c=[list(map(int,input().split())) for _ in range(3)]

ans = "Yes"
for i in range(2):
    # print("i =",i)
    if c[0][i] - c[0][i+1] != c[1][i] - c[1][i+1]:
        # print("check1")
        # print(c[0][i], "-", c[0][i+1], "!=", c[1][i], "-", c[1][i+1])
        ans = "No"
    elif c[1][i] - c[1][i+1] != c[2][i] - c[2][i+1]:
        # print("check2")
        # print(c[1][i], "-", c[1][i+1], "!=", c[2][i], "-", c[2][i+1])
        ans = "No"
    elif c[i][0] - c[i+1][0] != c[i][1] - c[i+1][1]:
        # print("check3")
        # print(c[i][0], "-", c[i+1][0], "!=", c[i+1][1], "-", c[i+1][1])
        ans = "No"
    elif c[i][1] - c[i+1][1] != c[i][2] - c[i+1][2]:
        # print("check4")
        # print(c[i][1], "-", c[i+1][1], "!=", c[i+1][2], "-", c[i+1][2])
        ans = "No"
print(ans)

l = []
for i in range(3):
    c1,c2,c3 = map(int, input().split())
    l.append([c1,c2,c3])

# assign a1 as 0
b1 = l[0][0]
b2 = l[1][0]
b3 = l[2][0]

flag = 0
for i in range(3):
    if not (l[0][1]-b1 == l[1][1]-b2 == l[2][1]-b3):
        flag = 1
    if not (l[0][2]-b1 == l[1][2]-b2 == l[2][2]-b3):
        flag = 1
if flag == 1:
    print('No' , flush=True)
else:
    print('Yes' , flush=True)

# TLE
# l = []
# for i in range(3):
#     c1,c2,c3 = map(int, input().split())
#     l.append([c1,c2,c3])

# def check_sum(i,j):
#     for r in range(3):
#         if r == i:
#             continue;
#         for c in range(3):
#             if c == j:
#                 continue;
#             sum_a = l[i][j] + l[r][c]
#             sum_b = l[r][j] + l[i][c]
#             if sum_a == sum_b:
#                 return 1
#             else:
#                 return -1
#                 break;

# for i in range(3):
#     for j in range(3):
#         flag = check_sum(i, j)
#         if flag == -1:
#             break;

# if flag == 1:
#     print('Yes' , flush=True)
# else:
#     print('No' , flush=True)


c1 = list(map(int, input().split()))
c2 = list(map(int, input().split()))
c3 = list(map(int, input().split()))

f = 0
for a1 in range(min(c1)+1):
    b1 = c1[0]-a1
    b2 = c1[1]-a1
    b3 = c1[2]-a1

    a2_1 = c2[0]-b1
    a2_2 = c2[1]-b2
    a2_3 = c2[2]-b3
    if not (a2_1==a2_2 and a2_2==a2_3):
        continue

    a3_1 = c3[0]-b1
    a3_2 = c3[1]-b2
    a3_3 = c3[2]-b3
    if not (a3_1==a3_2 and a3_2==a3_3):
        continue

    print("Yes")
    f=1
    break

if not f:
    print("No")

#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
  return int(readline())
C = [readInts() for _ in range(3)]
A = [0] * 3
B = [0] * 3
A[0] = 0
for i in range(3):
    B[i] = C[0][i]
for j in range(3):
    A[j] = C[j][0] - B[0]
for i in range(3):
    for j in range(3):
        if A[i] + B[j] == C[i][j]:
            pass
        else:
            print('No')
            return
print('Yes')


c_1_1, c_1_2, c_1_3 = map(int, input().split())
c_2_1, c_2_2, c_2_3 = map(int, input().split())
c_3_1, c_3_2, c_3_3 = map(int, input().split())

ans = "No"
for a_1 in range(101):
  b_1 = c_1_1 - a_1
  b_2 = c_1_2 - a_1
  b_3 = c_1_3 - a_1
  for a_2 in range(101):
    if c_2_1 != a_2 + b_1:
      continue
    if c_2_2 != a_2 + b_2:
      continue
    if c_2_3 != a_2 + b_3:
      continue
    for a_3 in range(101):
      if c_3_1 != a_3 + b_1:
        continue
      if c_3_2 != a_3 + b_2:
        continue
      if c_3_3 != a_3 + b_3:
        continue
      ans = "Yes"
      break
    if ans == "Yes":
      break
  if ans == "Yes":
    break

print(ans)

c=[[] for _ in range(3)]
for i in range(3):
    c[i] = list(map(int, input().split()))

diff0 = [x - y for x, y in zip(c[0], c[1])]
diff1 = [x - y for x, y in zip(c[0], c[2])]
 
if diff0[0] == diff0[1] and diff0[0] == diff0[2] and diff1[0] == diff1[1] and diff1[0] == diff1[2]:
    print('Yes')
else:
    print('No')





#18 C - Takahashi's Information
c = [list(map(int,input().split())) for _ in range(3)]

cnt = 0
if (c[0][0] - c[1][0]) == (c[0][1] - c[1][1]) == (c[0][2] - c[1][2]):
    cnt += 1
if (c[1][0] - c[2][0]) == (c[1][1] - c[2][1]) == (c[1][2] - c[2][2]):
    cnt += 1
if (c[2][0] - c[0][0]) == (c[2][1] - c[0][1]) == (c[2][2] - c[0][2]):
    cnt += 1
if cnt == 3:
    print('Yes')
else:
    print('No')

import sys

input = sys.stdin.readline

#N
#t1 x1 y1t1 x1 y1
#t2 x2 y2t2 x2 y2
#⋮⋮
#tN xN yNtN xN yN
N = 3
x = [0 for i in range(N)]
y = [0 for i in range(N)]
c =[[0 for i in range(N)] for i in range(N)]

for i in range(N):
    c1, c2, c3 = map(int, input().split())
    c[i][0] = c1
    c[i][1] = c2
    c[i][2] = c3


x[0] = 0
for i in range(N):
    y[i] = c[0][i] - x[0]
x[1] = c[1][0] - y[0]
x[2] = c[2][0] - y[0]

flag = True
for i in range(N):
   for j in range(N):
       numx = x[i]
       numy = y[j]
       if not numx + numy == c[i][j]:
           flag = False
if flag:
    print("Yes")
else:
    print("No")

c=[list(map(int,input().split())) for _ in range(3)]
a=[0,0,0]
b=[0,0,0]

for i in range(3):
  b[i] = c[0][i] - a[0]

for i in range(1,3):
  a[i] = c[i][0] - b[0]

for i in range(3):
  for j in range(3):
    if c[i][j] != a[i]+b[j]:
      print("No")
      return
print("Yes")

#18
import sys
c = [list(map(int,input().split())) for i in range(3)]

if not(c[0][0] - c[0][1] == c[1][0] - c[1][1] == c[2][0] - c[2][1]):
    print("No")
    return
if not(c[0][0] - c[0][2] == c[1][0] - c[1][2] == c[2][0] - c[2][2]):
    print("No")
    return
if not(c[0][1] - c[0][2] == c[1][1] - c[1][2] == c[2][1] - c[2][2]):
    print("No")
    return
if not(c[0][0] - c[1][0] == c[0][1] - c[1][1] == c[0][2] - c[1][2]):
    print("No")
    return
if not(c[0][0] - c[2][0] == c[0][1] - c[2][1] == c[0][2] - c[2][2]):
    print("No")
    return
if not(c[1][0] - c[2][0] == c[1][1] - c[2][1] == c[1][2] - c[2][2]):
    print("No")
    return
print("Yes")
    



totalArray=[]
answer ='No'
Yoko=False
tate=False
for i in range(3):
  array=input().split(' ')
  for j in range(len(array)):
    totalArray.append(int(array[j]))
if (totalArray[1]-totalArray[0]) == (totalArray[4]-totalArray[3]) == (totalArray[7]-totalArray[6]) and (totalArray[2]-totalArray[1]) == (totalArray[5]-totalArray[4]) == (totalArray[8]-totalArray[7]):
  Yoko=True
if (totalArray[3]-totalArray[0]) == (totalArray[4]-totalArray[1]) == (totalArray[5]-totalArray[2]) and (totalArray[6]-totalArray[3]) == (totalArray[7]-totalArray[4]) == (totalArray[8]-totalArray[5]):
  tate=True
if Yoko==True and tate==True:
  print('Yes')
else:
  print('No')

C = [list(map(int, input().split())) for _ in range(3)]
if not (C[0][0] - C[0][1] == C[1][0] - C[1][1] == C[2][0] - C[2][1]):
    print("No")
    return
if not (C[0][0] - C[0][2] == C[1][0] - C[1][2] == C[2][0] - C[2][2]):
    print("No")
    return
if not (C[0][2] - C[0][1] == C[1][2] - C[1][1] == C[2][2] - C[2][1]):
    print("No")
    return

print("Yes")


c = [
    list(map(int, input().split()))
    for _ in range(3)
]

f = True
for j in range(2):
    x = c[j][0] - c[j + 1][0]
    y = c[0][j] - c[0][j + 1]
    for i in range(3):
        if c[j][i] - c[j + 1][i] != x:
            f = False
        if c[i][j] - c[i][j + 1] != y:
            f = False
print(['No', 'Yes'][int(f)])

L = [list(map(int,input().split())) for _ in range(3)]
ans = 'Yes'

if L[0][0] + L[1][1] != L[0][1] + L[1][0]: ans = 'No'
if L[0][1] + L[1][2] != L[0][2] + L[1][1]: ans = 'No'
if L[1][0] + L[2][1] != L[1][1] + L[2][0]: ans = 'No'
if L[1][1] + L[2][2] != L[1][2] + L[2][1]: ans = 'No'

print(ans)

a = []
a.append(list(map(int, input().split())))
a.append(list(map(int, input().split())))
a.append(list(map(int, input().split())))

if not((a[0][2]-a[0][1]) == (a[1][2]-a[1][1]) == (a[2][2]-a[2][1])):
    print("No")
    return

if not((a[0][1]-a[0][0]) == (a[1][1]-a[1][0]) == (a[2][1]-a[2][0])):
    print("No")
    return

if not((a[0][0]-a[1][0]) == (a[0][1]-a[1][1]) == (a[0][2]-a[1][2])):
    print("No")
    return

if not((a[2][0]-a[1][0])== (a[2][1]-a[1][1])== (a[2][2]-a[1][2])):
    print("No")
    return
print("Yes")


c = [[int(x) for x in input().split()] for _ in range(3)]

ans = False
for a1 in range(101):
    for a2 in range(101):
        for a3 in range(101):
            ok = True
            b1 = c[0][0] - a1
            b2 = c[0][1] - a1
            b3 = c[0][2] - a1
            if c[1][0] != a2 + b1 or \
               c[1][1] != a2 + b2 or \
               c[1][2] != a2 + b3 or \
               c[2][0] != a3 + b1 or \
               c[2][1] != a3 + b2 or \
               c[2][2] != a3 + b3:
               ok = False
            if ok:
                ans = True

if ans:
    print("Yes")
else:
    print("No")   





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


import numpy as np

l = [list(map(int,input().split())) for i in range(3)]
l_2 =np.array(l).T 

def square(l):
  flag = 1
  for i in range(2):
    for j in range(2):
      if l[j][i] - l[j+1][i] !=  l[j][i+1] - l[j+1][i+1]:
        flag = 0
  return flag
if square(l) * square(l_2) == 1:
  print("Yes")
else:
  print("No")
    









# Problem: https://atcoder.jp/contests/abc088/tasks/abc088_c
# Python 3rd Try

import sys
# from collections import defaultdict
# import heapq,copy
import pprint as pp
# from collections import deque
def II(): return int(sys.stdin.readline())
def MI(): return list(map(int, sys.stdin.readline().split()))
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


# Const
MAXSIZE = ( 1 << 31 ) -1
MINSIZE = -( 1 << 31) + 1
yes = "Yes"
no = "No"

def solver(line00,line01,line02,
           line10,line11,line12,
           line20,line21,line22):

    result = no
    a0 = 0
    b0 = line00
    b1 = line01 - a0
    b2 = line02 - a0
    a1 = line10 -line00
    a2 = line20 - line00
    if (( a1 + b1 ) == line11) and (( a1 + b2 ) == line12
    ) and (( a2 + b1 ) == line21) and (( a2 + b2 ) == line22):
        result = yes
    return result


def __starting_point():
    line00 , line01, line02 = MI()
    line10 , line11, line12 = MI()
    line20 , line21, line22 = MI()
    print(("{}".format(solver(line00, line01, line02,
                             line10, line11, line12,
                             line20, line21, line22))))

__starting_point()

#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(c: "List[List[int]]"):
    from itertools import product
    for a1, b1 in product(list(range(101)), repeat=2):
        a2 = c[1][0] - b1
        a3 = c[2][0] - b1
        b2 = c[0][1] - a1
        b3 = c[0][2] - a1
        if a2 < 0 or a3 < 0 or b2 < 0 or b3 < 0:
            continue
        a = [a1, a2, a3]
        b = [b1, b2, b3]
        if all((a[i]+b[j])==c[i][j] for i, j in product(list(range(3)), repeat=2)):
            return YES
    return NO

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    c = [[int(next(tokens)) for _ in range(3)] for _ in range(3)]  # type: "List[List[int]]"
    print((solve(c)))

def test():
    import doctest
    doctest.testmod()

def __starting_point():
    #test()
    main()

__starting_point()

c = [list(map(int,input().split())) for _ in range(3)]

ok = True

lis = [[0,1],[1,2],[2,0]]

d = [[c[l[0]][i]-c[l[1]][i] for i in range(3)]for l in lis]
e = [[c[i][l[0]]-c[i][l[1]] for i in range(3)]for l in lis]

for i in range(3):
    if d[i].count(d[i][0])!=3:
        ok = False
    if e[i].count(e[i][0])!=3:
        ok = False
        
if ok:
    print('Yes')
else:
    print('No')


c = [list(map(int, input().split())) for _ in range(3)]

diff0 = [x - y for x, y in zip(c[0], c[1])]
diff1 = [x - y for x, y in zip(c[0], c[2])]

if diff0[0] == diff0[1] and diff0[0] == diff0[2] and diff1[0] == diff1[1] and diff1[0] == diff1[2]:
    print('Yes')
else:
    print('No')

c = []
for i in range(3):
  c.append([int(x) for x in input().split()])
res = "No"
for i in range(101):
  for j in range(101):
    for k in range(101):
      if c[0][0] - i == c[1][0] - j == c[2][0] - k:
        if c[0][1] - i == c[1][1] - j == c[2][1] - k:
          if c[0][2] - i == c[1][2] - j == c[2][2] - k:
            res = "Yes"
print(res)

grid = [[-1] * 4 for i in range(4)]
for i in range(1,4):
    grid[i][1],grid[i][2],grid[i][3] = list(map(int,input().split()))
    grid[i][0] = min(grid[i][1],grid[i][2],grid[i][3])
#print('----------')
#for i in range(4):
#    print(grid[i])

isOK = False
for i in range(grid[1][0]+1):
    grid[0][0] = i
    grid[0][1] = grid[1][1]-i
    grid[0][2] = grid[1][2]-i
    grid[0][3] = grid[1][3]-i
#    print('----------')
#    for j in range(4):
#        print(grid[j])
    if grid[2][1]-grid[0][1] == grid[2][2]-grid[0][2] and grid[2][2]-grid[0][2] == grid[2][3]-grid[0][3]:
        if grid[3][1]-grid[0][1] == grid[3][2]-grid[0][2] and grid[3][2]-grid[0][2] == grid[3][3]-grid[0][3]:
            isOK = True
            break
if isOK:
    print('Yes')
else:
    print('No')


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

def main():
    grid = [list(map(int, input().split())) for i in range(3)]
    all = sum(sum(grid, []))
    a = [0] * 3
    b = [0] * 3
    for i1 in range(0, grid[0][0] + 1):
        a[0] = i1
        b[0] = grid[0][0] - i1
        for j2 in range(0, grid[1][1] + 1):
            a[1] = j2
            b[1] = grid[1][1] - j2
            for k3 in range(0, grid[2][2] + 1):
                a[2] = k3
                b[2] = grid[2][2] - k3
                if (sum(a) * 3) + (sum(b) * 3) == all:
                    print("Yes")
                    return
    print('No')





def __starting_point():
    main()
__starting_point()

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

a1,a2,a3=[0,c[1][1]-c[0][1],c[2][1]-c[0][1]]
b1,b2,b3=[c[0][0],c[0][1],c[0][2]]

ans=[[a1+b1,a1+b2,a1+b3],[a2+b1,a2+b2,a2+b3],[a3+b1,a3+b2,a3+b3]]

if ans==c:
    print("Yes")
else:
    print("No")




c = [list(map(int,input().split())) for i in range(3)]

for i in range(0,2):
    if not c[0][0+i]-c[0][1+i] \
        == c[1][0+i]-c[1][1+i] \
        == c[2][0+i]-c[2][1+i]:
        print('No')
        break

    if not c[0+i][0]-c[1+i][0] \
        == c[0+i][1]-c[1+i][1] \
        == c[0+i][2]-c[1+i][2]:
        print('No')
        break
else:
    print('Yes')


def main():
    c_lst = [list(map(int, input().split())) for _ in range(3)]
    c1 = c_lst[0][0] + c_lst[1][1] + c_lst[2][2]
    c2 = c_lst[1][0] + c_lst[2][1] + c_lst[0][2]
    c3 = c_lst[2][0] + c_lst[0][1] + c_lst[1][2]
    
    if c1 == c2 and c2 == c3:
        print('Yes')
    else:
        print('No')
        

def __starting_point():
    main()
__starting_point()

C = []
for _ in range(3):
    c = list(map(int, input().split()))
    C.append(c)
    
a = [0, C[1][1]-C[0][1], C[2][1]-C[0][1]]
b = [C[0][0], C[0][1], C[0][2]]

ans = [[a[0]+b[0], a[0]+b[1], a[0]+b[2]], [a[1]+b[0], a[1]+b[1], a[1]+b[2]], [a[2]+b[0], a[2]+b[1], a[2]+b[2]]]

if ans == C:
    print("Yes")
else:
    print("No")

c = [list(map(int,input().split())) for _ in range(3)]
if (c[2][0]-c[1][0])==(c[2][1]-c[1][1])==(c[2][2]-c[1][2]) and (c[1][0]-c[0][0])==(c[1][1]-c[0][1])==(c[1][2]-c[0][2]) and (c[2][2]-c[2][1])==(c[1][2]-c[1][1])==(c[0][2]-c[0][1]) and (c[2][1]-c[2][0])==(c[1][1]-c[1][0])==(c[0][1]-c[0][0]):
    print("Yes")
else:
    print("No")

def LIHW(h):
    return [list(map(int, input().split())) for _ in range(h)]


masu = LIHW(3)
ans = "Yes"
for i in range(2):
    if masu[i+1][1]-masu[i+1][0] != masu[0][1]-masu[0][0]:
        ans = "No"
    if masu[i+1][2]-masu[i+1][1] != masu[0][2]-masu[0][1]:
        ans = "No"
for i in range(2):
    if masu[1][i+1]-masu[0][i+1] != masu[1][0]-masu[0][0]:
        ans = "No"
    if masu[2][i+1]-masu[1][i+1] != masu[2][0]-masu[1][0]:
        ans = "No"
print(ans)


import numpy as np

M = np.array(list(map(int,open(0).read().split()))).reshape(3,3)

hSum = M.sum(axis=0)
vSum = M.sum(axis=1)

f=True
for i in range(3):
  if (hSum[i]-hSum[(i+1)%3])%3!=0:
    f = False

for i in range(3):
  if (vSum[i]-vSum[(i+1)%3])%3!=0:
    f = False
    
print("Yes" if f else "No")

cc = [list(map(int, input().split())) for i in range(3)]
tc = [x for c in cc for x in c]

if sum(tc) % 3 != 0:
  print('No')
else:
  cnt = 0
  for i in range(3):
    cnt  += cc[i][i]
  if cnt == sum(tc)//3:
    print('Yes')
  else:
    print('No')

c = [list(map(int, input().split())) for _ in range(3)]

flag = True

for i in range(1, 3):
    if not(c[i][0] - c[0][0] == c[i][1] - c[0][1] == c[i][2] - c[0][2]):
        flag = False
    if not(c[0][i] - c[0][0] == c[1][i] - c[1][0] == c[2][i] - c[2][0]):
        flag = False

if flag:
    print("Yes")
else:
    print("No")


c = [list(map(int,input().split())) for i in range(3)]
ans = "Yes"
for i in range(3):
    for j in range(3):
        if c[i][j]==c[i-1][j]+c[i][j-1]-c[i-1][j-1]:
            continue
        ans = "No"
print(ans)


c = [list(map(int, input().split())) for i in range(3)]

flag = False
for a0 in range(-100, 200):
    b0 = c[0][0] - a0
    a1 = c[1][0] - b0
    a2 = c[2][0] - b0
    b1 = c[0][1] - a0
    b2 = c[0][2] - a0
    if (a1 + b1 == c[1][1]
            and a2 + b1 == c[2][1]
            and a1 + b2 == c[1][2]
            and a2 + b2 == c[2][2]):
        flag = True

if flag:
    print("Yes")
else:
    print("No")

import itertools
def main():
    grid = [list(map(int, input().split())) for i in range(3)]
    all = sum(sum(grid, []))
    a = [0] * 3
    b = [0] * 3
    for i, j, k in itertools.product(list(range(grid[0][0] + 1)), list(range(grid[1][1] + 1)), list(range(grid[2][2] + 1))):
        a = [i, j, k]
        b = [grid[idx][idx] - v for idx, v in enumerate(a)]
        if (sum(a) * 3) + (sum(b) * 3) == all:
            print("Yes")
            return
    print('No')


def __starting_point():
    main()

__starting_point()

c = [[0]*3]*3

for i in range(3):
    c[i] = [int(x) for x in input().split()]

ans = False

if c[0][0] - c[0][1] == c[1][0] - c[1][1] == c[2][0] - c[2][1] and\
    c[0][0] - c[0][2] == c[1][0] - c[1][2] == c[2][0] - c[2][2]:
    ans = True

if ans == True:
    print('Yes')
else: # ans == False:
    print('No')

xy = [list(map(int, input().split())) for i in range(3)]
result = sum(map(sum, xy))
if result % 3 != 0:
    print("No")
    return
if result != (xy[0][0]+xy[1][1]+xy[2][2]) * 3:
    print("No")
    return
if result != (xy[0][2]+xy[1][1]+xy[2][0]) * 3:
    print("No")
    return
else:
    print("Yes")

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

c1 = list(map(int,input().split()))
c2 = list(map(int,input().split()))
c3 = list(map(int,input().split()))

sw = 1
b1 = min(c1)
a = [c1[0]-b1, c1[1]-b1, c1[2]-b1]

if not(c2[0]-a[0] == c2[1]-a[1] == c2[2]-a[2]):
    sw = 0
if not(c3[0]-a[0] == c3[1]-a[1] == c3[2]-a[2]):
    sw = 0
    
print((["No","Yes"][sw]))


c1 = list(map(int,input().split()))
c2 = list(map(int,input().split()))
c3 = list(map(int,input().split()))

a1_a2 = c1[0] - c2[0]
a2_a3 = c2[0] - c3[0]
b1_b2 = c1[0] - c1[1]
b2_b3 = c1[1] - c1[2]

cnt = 0
if a1_a2 == c1[1]-c2[1] == c1[2]-c2[2]:
    cnt += 1
if a2_a3 == c2[1]-c3[1] == c2[2]-c3[2]:
    cnt += 1
if b1_b2 == c2[0]-c2[1] == c3[0]-c3[1]:
    cnt += 1
if b2_b3 == c2[1]-c2[2] == c3[1]-c3[2]:
    cnt += 1

if cnt == 4:
    print("Yes")
else:
    print("No")

N = 3
c = [list(map(int, input().split())) for _ in range(N)]
ds = [sum(c[j][(i + j) % 3] for j in range(N)) for i in range(N)]
if ds[0] == ds[1] == ds[2]:
    print("Yes")
else:
    print("No")


ls = []
for i in range(3):
    ls.append(list(map(int,input().split())))
ans = 'Yes'
if ls[1][1]-ls[1][0] != ls[0][1]-ls[0][0]:
    ans = 'No'
if ls[2][1]-ls[2][0] != ls[0][1]-ls[0][0]:
    ans = 'No'   
if ls[1][2]-ls[1][0] != ls[0][2]-ls[0][0]:
    ans = 'No'
if ls[2][2]-ls[2][0] != ls[0][2]-ls[0][0]:
    ans = 'No'
print(ans)

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




C1 = list(map(int,input().split()))
C2 = list(map(int,input().split()))
C3 = list(map(int,input().split()))

if C1[0]-C1[1]==C2[0]-C2[1]==C3[0]-C3[1] and C1[1]-C1[2]==C2[1]-C2[2]==C3[1]-C3[2] and C1[0]-C2[0]==C1[1]-C2[1]==C1[2]-C2[2] and C2[0]-C3[0]==C2[1]-C3[1]==C2[2]-C3[2]: 
  print("Yes")
else:
  print("No")