import java.util.*;

public class Main {
        public static void main(String[] args) {
            int[][] grid = new int[3][3];
            Scanner sc = new Scanner(System.in);
            for(int row = 0; row < 3; row++) {
                for(int col = 0; col < 3; col++) {
                    grid[row][col] = sc.nextInt();
                }
            }
            int aDiff1 = grid[0][0] - grid[0][1];
            int aDiff2 = grid[0][1] - grid[0][2];
            int bDiff1 = grid[0][0] - grid[1][0];
            int bDiff2 = grid[1][0] - grid[2][0];
            if((grid[1][0] - aDiff1 != grid[1][1]) || (grid[1][1] - aDiff2 != grid[1][2]) || (grid[2][0] - aDiff1 != grid[2][1]) || (grid[2][1] - aDiff2 != grid[2][2]) ||
                            (grid[0][1] - bDiff1 != grid[1][1]) || (grid[1][1] - bDiff2 != grid[2][1]) || (grid[0][2] - bDiff1 != grid[1][2]) || (grid[1][2] - bDiff2 != grid[2][2])) {
                System.out.println("No");
            } else {
                System.out.println("Yes");
            }
        }
} import java.util.*; util.* java public class Main {
        public static void main(String[] args) {
            int[][] grid = new int[3][3];
            Scanner sc = new Scanner(System.in);
            for(int row = 0; row < 3; row++) {
                for(int col = 0; col < 3; col++) {
                    grid[row][col] = sc.nextInt();
                }
            }
            int aDiff1 = grid[0][0] - grid[0][1];
            int aDiff2 = grid[0][1] - grid[0][2];
            int bDiff1 = grid[0][0] - grid[1][0];
            int bDiff2 = grid[1][0] - grid[2][0];
            if((grid[1][0] - aDiff1 != grid[1][1]) || (grid[1][1] - aDiff2 != grid[1][2]) || (grid[2][0] - aDiff1 != grid[2][1]) || (grid[2][1] - aDiff2 != grid[2][2]) ||
                            (grid[0][1] - bDiff1 != grid[1][1]) || (grid[1][1] - bDiff2 != grid[2][1]) || (grid[0][2] - bDiff1 != grid[1][2]) || (grid[1][2] - bDiff2 != grid[2][2])) {
                System.out.println("No");
            } else {
                System.out.println("Yes");
            }
        }
} Main public static void main(String[] args) {
            int[][] grid = new int[3][3];
            Scanner sc = new Scanner(System.in);
            for(int row = 0; row < 3; row++) {
                for(int col = 0; col < 3; col++) {
                    grid[row][col] = sc.nextInt();
                }
            }
            int aDiff1 = grid[0][0] - grid[0][1];
            int aDiff2 = grid[0][1] - grid[0][2];
            int bDiff1 = grid[0][0] - grid[1][0];
            int bDiff2 = grid[1][0] - grid[2][0];
            if((grid[1][0] - aDiff1 != grid[1][1]) || (grid[1][1] - aDiff2 != grid[1][2]) || (grid[2][0] - aDiff1 != grid[2][1]) || (grid[2][1] - aDiff2 != grid[2][2]) ||
                            (grid[0][1] - bDiff1 != grid[1][1]) || (grid[1][1] - bDiff2 != grid[2][1]) || (grid[0][2] - bDiff1 != grid[1][2]) || (grid[1][2] - bDiff2 != grid[2][2])) {
                System.out.println("No");
            } else {
                System.out.println("Yes");
            }
        } main {
            int[][] grid = new int[3][3];
            Scanner sc = new Scanner(System.in);
            for(int row = 0; row < 3; row++) {
                for(int col = 0; col < 3; col++) {
                    grid[row][col] = sc.nextInt();
                }
            }
            int aDiff1 = grid[0][0] - grid[0][1];
            int aDiff2 = grid[0][1] - grid[0][2];
            int bDiff1 = grid[0][0] - grid[1][0];
            int bDiff2 = grid[1][0] - grid[2][0];
            if((grid[1][0] - aDiff1 != grid[1][1]) || (grid[1][1] - aDiff2 != grid[1][2]) || (grid[2][0] - aDiff1 != grid[2][1]) || (grid[2][1] - aDiff2 != grid[2][2]) ||
                            (grid[0][1] - bDiff1 != grid[1][1]) || (grid[1][1] - bDiff2 != grid[2][1]) || (grid[0][2] - bDiff1 != grid[1][2]) || (grid[1][2] - bDiff2 != grid[2][2])) {
                System.out.println("No");
            } else {
                System.out.println("Yes");
            }
        } int[][] grid = new int[3][3]; grid new int[3][3] 3 3 Scanner sc = new Scanner(System.in); sc new Scanner(System.in) for(int row = 0; row < 3; row++) {
                for(int col = 0; col < 3; col++) {
                    grid[row][col] = sc.nextInt();
                }
            } int row = 0; int row = 0; row 0 row < 3 row 3 row++ row++ row {
                for(int col = 0; col < 3; col++) {
                    grid[row][col] = sc.nextInt();
                }
            } {
                for(int col = 0; col < 3; col++) {
                    grid[row][col] = sc.nextInt();
                }
            } for(int col = 0; col < 3; col++) {
                    grid[row][col] = sc.nextInt();
                } int col = 0; int col = 0; col 0 col < 3 col 3 col++ col++ col {
                    grid[row][col] = sc.nextInt();
                } {
                    grid[row][col] = sc.nextInt();
                } grid[row][col] = sc.nextInt() grid[row][col] grid[row] grid row col sc.nextInt() sc.nextInt sc int aDiff1 = grid[0][0] - grid[0][1]; aDiff1 grid[0][0] - grid[0][1] grid[0][0] grid[0] grid 0 0 grid[0][1] grid[0] grid 0 1 int aDiff2 = grid[0][1] - grid[0][2]; aDiff2 grid[0][1] - grid[0][2] grid[0][1] grid[0] grid 0 1 grid[0][2] grid[0] grid 0 2 int bDiff1 = grid[0][0] - grid[1][0]; bDiff1 grid[0][0] - grid[1][0] grid[0][0] grid[0] grid 0 0 grid[1][0] grid[1] grid 1 0 int bDiff2 = grid[1][0] - grid[2][0]; bDiff2 grid[1][0] - grid[2][0] grid[1][0] grid[1] grid 1 0 grid[2][0] grid[2] grid 2 0 if((grid[1][0] - aDiff1 != grid[1][1]) || (grid[1][1] - aDiff2 != grid[1][2]) || (grid[2][0] - aDiff1 != grid[2][1]) || (grid[2][1] - aDiff2 != grid[2][2]) ||
                            (grid[0][1] - bDiff1 != grid[1][1]) || (grid[1][1] - bDiff2 != grid[2][1]) || (grid[0][2] - bDiff1 != grid[1][2]) || (grid[1][2] - bDiff2 != grid[2][2])) {
                System.out.println("No");
            } else {
                System.out.println("Yes");
            } (grid[1][0] - aDiff1 != grid[1][1]) || (grid[1][1] - aDiff2 != grid[1][2]) || (grid[2][0] - aDiff1 != grid[2][1]) || (grid[2][1] - aDiff2 != grid[2][2]) ||
                            (grid[0][1] - bDiff1 != grid[1][1]) || (grid[1][1] - bDiff2 != grid[2][1]) || (grid[0][2] - bDiff1 != grid[1][2]) || (grid[1][2] - bDiff2 != grid[2][2]) (grid[0][2] - bDiff1 != grid[1][2]) (grid[1][1] - bDiff2 != grid[2][1]) (grid[0][1] - bDiff1 != grid[1][1]) (grid[2][1] - aDiff2 != grid[2][2]) (grid[2][0] - aDiff1 != grid[2][1]) (grid[1][0] - aDiff1 != grid[1][1]) || (grid[1][1] - aDiff2 != grid[1][2]) || (grid[2][0] - aDiff1 != grid[2][1]) || (grid[2][1] - aDiff2 != grid[2][2]) ||
                            (grid[0][1] - bDiff1 != grid[1][1]) || (grid[1][1] - bDiff2 != grid[2][1]) || (grid[0][2] - bDiff1 != grid[1][2]) || (grid[1][2] - bDiff2 != grid[2][2]) (grid[1][0] - aDiff1 != grid[1][1]) grid[1][0] - aDiff1 grid[1][0] grid[1] grid 1 0 aDiff1 grid[1][1] grid[1] grid 1 1 (grid[1][1] - aDiff2 != grid[1][2]) grid[1][1] - aDiff2 grid[1][1] grid[1] grid 1 1 aDiff2 grid[1][2] grid[1] grid 1 2 (grid[2][0] - aDiff1 != grid[2][1]) grid[2][0] - aDiff1 grid[2][0] grid[2] grid 2 0 aDiff1 grid[2][1] grid[2] grid 2 1 (grid[2][1] - aDiff2 != grid[2][2]) grid[2][1] - aDiff2 grid[2][1] grid[2] grid 2 1 aDiff2 grid[2][2] grid[2] grid 2 2 (grid[0][1] - bDiff1 != grid[1][1]) grid[0][1] - bDiff1 grid[0][1] grid[0] grid 0 1 bDiff1 grid[1][1] grid[1] grid 1 1 (grid[1][1] - bDiff2 != grid[2][1]) grid[1][1] - bDiff2 grid[1][1] grid[1] grid 1 1 bDiff2 grid[2][1] grid[2] grid 2 1 (grid[0][2] - bDiff1 != grid[1][2]) grid[0][2] - bDiff1 grid[0][2] grid[0] grid 0 2 bDiff1 grid[1][2] grid[1] grid 1 2 (grid[1][2] - bDiff2 != grid[2][2]) grid[1][2] - bDiff2 grid[1][2] grid[1] grid 1 2 bDiff2 grid[2][2] grid[2] grid 2 2 {
                System.out.println("No");
            } System.out.println("No") System.out.println System.out System System.out "No" {
                System.out.println("Yes");
            } System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] args args public class Main {
        public static void main(String[] args) {
            int[][] grid = new int[3][3];
            Scanner sc = new Scanner(System.in);
            for(int row = 0; row < 3; row++) {
                for(int col = 0; col < 3; col++) {
                    grid[row][col] = sc.nextInt();
                }
            }
            int aDiff1 = grid[0][0] - grid[0][1];
            int aDiff2 = grid[0][1] - grid[0][2];
            int bDiff1 = grid[0][0] - grid[1][0];
            int bDiff2 = grid[1][0] - grid[2][0];
            if((grid[1][0] - aDiff1 != grid[1][1]) || (grid[1][1] - aDiff2 != grid[1][2]) || (grid[2][0] - aDiff1 != grid[2][1]) || (grid[2][1] - aDiff2 != grid[2][2]) ||
                            (grid[0][1] - bDiff1 != grid[1][1]) || (grid[1][1] - bDiff2 != grid[2][1]) || (grid[0][2] - bDiff1 != grid[1][2]) || (grid[1][2] - bDiff2 != grid[2][2])) {
                System.out.println("No");
            } else {
                System.out.println("Yes");
            }
        }
} public class Main {
        public static void main(String[] args) {
            int[][] grid = new int[3][3];
            Scanner sc = new Scanner(System.in);
            for(int row = 0; row < 3; row++) {
                for(int col = 0; col < 3; col++) {
                    grid[row][col] = sc.nextInt();
                }
            }
            int aDiff1 = grid[0][0] - grid[0][1];
            int aDiff2 = grid[0][1] - grid[0][2];
            int bDiff1 = grid[0][0] - grid[1][0];
            int bDiff2 = grid[1][0] - grid[2][0];
            if((grid[1][0] - aDiff1 != grid[1][1]) || (grid[1][1] - aDiff2 != grid[1][2]) || (grid[2][0] - aDiff1 != grid[2][1]) || (grid[2][1] - aDiff2 != grid[2][2]) ||
                            (grid[0][1] - bDiff1 != grid[1][1]) || (grid[1][1] - bDiff2 != grid[2][1]) || (grid[0][2] - bDiff1 != grid[1][2]) || (grid[1][2] - bDiff2 != grid[2][2])) {
                System.out.println("No");
            } else {
                System.out.println("Yes");
            }
        }
} Main
import java.util.*;

public class Main {
        public static void main(String[] args) {
            int[][] grid = new int[3][3];
            Scanner sc = new Scanner(System.in);
            for(int row = 0; row < 3; row++) {
                for(int col = 0; col < 3; col++) {
                    grid[row][col] = sc.nextInt();
                }
            }
            int aDiff1 = grid[0][0] - grid[0][1];
            int aDiff2 = grid[0][1] - grid[0][2];
            int bDiff1 = grid[0][0] - grid[1][0];
            int bDiff2 = grid[1][0] - grid[2][0];
            if((grid[1][0] - aDiff1 != grid[1][1]) || (grid[1][1] - aDiff2 != grid[1][2]) || (grid[2][0] - aDiff1 != grid[2][1]) || (grid[2][1] - aDiff2 != grid[2][2]) ||
                            (grid[0][1] - bDiff1 != grid[1][1]) || (grid[1][1] - bDiff2 != grid[2][1]) || (grid[0][2] - bDiff1 != grid[1][2]) || (grid[1][2] - bDiff2 != grid[2][2])) {
                System.out.println("No");
            } else {
                System.out.println("Yes");
            }
        }
}
