module Main where
import Data.Char
import Data.List
int = read :: String -> Int
getWord :: IO String
getWord = do
  c <- getChar
  if isSpace c
  then
    return []
  else do
    ws <- getWord
    return (c:ws)
getInt = fmap int getWord
replace pred a = map (\x -> if pred x then a else x)

main = interact $ printer . solver . parser
parser = map (map int . words) . lines
printer = unlines . (:[]) 

solver (rs@(r1:r2:r3:[])) =
    if and [ch1,ch2,ch3,ch4] then "Yes" else "No"
  where
    row12 = zipWith (-) r1 r2
    ch1 = and $ zipWith (==) row12 (tail row12)
    row23 = zipWith (-) r2 r3
    ch2 = and $ zipWith (==) row23 (tail row23)
    (c1:c2:c3:[]) = transpose rs
    col12 = zipWith (-) c1 c2
    ch3 = and $ zipWith (==) col12 (tail col12)
    col23 = zipWith (-) c2 c3
    ch4 = and $ zipWith (==) col23 (tail col23)