import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int grid[][] = new int[3][3];

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                grid[i][j] = sc.nextInt();
            }
        }

        // 横方向を見る
        for (int i = 0; i < 2; i++) {
            int a = (grid[i][0] - grid[i+1][0]);
            int b = (grid[i][1] - grid[i+1][1]);
            int c = (grid[i][2] - grid[i+1][2]);
            if (a != b || b != c) { System.out.println("No"); return; }
        }

        // 横方向を見る
        for (int i = 0; i < 2; i++) {
            int a = (grid[0][i] - grid[0][i+1]);
            int b = (grid[1][i] - grid[1][i+1]);
            int c = (grid[2][i] - grid[2][i+1]);
            if (a != b || b != c) { System.out.println("No"); return; }
        }

        System.out.println("Yes");
    }
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int grid[][] = new int[3][3];

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                grid[i][j] = sc.nextInt();
            }
        }

        // 横方向を見る
        for (int i = 0; i < 2; i++) {
            int a = (grid[i][0] - grid[i+1][0]);
            int b = (grid[i][1] - grid[i+1][1]);
            int c = (grid[i][2] - grid[i+1][2]);
            if (a != b || b != c) { System.out.println("No"); return; }
        }

        // 横方向を見る
        for (int i = 0; i < 2; i++) {
            int a = (grid[0][i] - grid[0][i+1]);
            int b = (grid[1][i] - grid[1][i+1]);
            int c = (grid[2][i] - grid[2][i+1]);
            if (a != b || b != c) { System.out.println("No"); return; }
        }

        System.out.println("Yes");
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int grid[][] = new int[3][3];

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                grid[i][j] = sc.nextInt();
            }
        }

        // 横方向を見る
        for (int i = 0; i < 2; i++) {
            int a = (grid[i][0] - grid[i+1][0]);
            int b = (grid[i][1] - grid[i+1][1]);
            int c = (grid[i][2] - grid[i+1][2]);
            if (a != b || b != c) { System.out.println("No"); return; }
        }

        // 横方向を見る
        for (int i = 0; i < 2; i++) {
            int a = (grid[0][i] - grid[0][i+1]);
            int b = (grid[1][i] - grid[1][i+1]);
            int c = (grid[2][i] - grid[2][i+1]);
            if (a != b || b != c) { System.out.println("No"); return; }
        }

        System.out.println("Yes");
    } main {
        Scanner sc = new Scanner(System.in);
        int grid[][] = new int[3][3];

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                grid[i][j] = sc.nextInt();
            }
        }

        // 横方向を見る
        for (int i = 0; i < 2; i++) {
            int a = (grid[i][0] - grid[i+1][0]);
            int b = (grid[i][1] - grid[i+1][1]);
            int c = (grid[i][2] - grid[i+1][2]);
            if (a != b || b != c) { System.out.println("No"); return; }
        }

        // 横方向を見る
        for (int i = 0; i < 2; i++) {
            int a = (grid[0][i] - grid[0][i+1]);
            int b = (grid[1][i] - grid[1][i+1]);
            int c = (grid[2][i] - grid[2][i+1]);
            if (a != b || b != c) { System.out.println("No"); return; }
        }

        System.out.println("Yes");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int grid[][] = new int[3][3]; grid new int[3][3] 3 3 for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                grid[i][j] = sc.nextInt();
            }
        } int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
            for (int j = 0; j < 3; j++) {
                grid[i][j] = sc.nextInt();
            }
        } {
            for (int j = 0; j < 3; j++) {
                grid[i][j] = sc.nextInt();
            }
        } for (int j = 0; j < 3; j++) {
                grid[i][j] = sc.nextInt();
            } int j = 0; int j = 0; j 0 j < 3 j 3 j++ j++ j {
                grid[i][j] = sc.nextInt();
            } {
                grid[i][j] = sc.nextInt();
            } grid[i][j] = sc.nextInt() grid[i][j] grid[i] grid i j sc.nextInt() sc.nextInt sc for (int i = 0; i < 2; i++) {
            int a = (grid[i][0] - grid[i+1][0]);
            int b = (grid[i][1] - grid[i+1][1]);
            int c = (grid[i][2] - grid[i+1][2]);
            if (a != b || b != c) { System.out.println("No"); return; }
        } int i = 0; int i = 0; i 0 i < 2 i 2 i++ i++ i {
            int a = (grid[i][0] - grid[i+1][0]);
            int b = (grid[i][1] - grid[i+1][1]);
            int c = (grid[i][2] - grid[i+1][2]);
            if (a != b || b != c) { System.out.println("No"); return; }
        } {
            int a = (grid[i][0] - grid[i+1][0]);
            int b = (grid[i][1] - grid[i+1][1]);
            int c = (grid[i][2] - grid[i+1][2]);
            if (a != b || b != c) { System.out.println("No"); return; }
        } int a = (grid[i][0] - grid[i+1][0]); a (grid[i][0] - grid[i+1][0]) grid[i][0] grid[i] grid i 0 grid[i+1][0] grid[i+1] grid i+1 i 1 0 int b = (grid[i][1] - grid[i+1][1]); b (grid[i][1] - grid[i+1][1]) grid[i][1] grid[i] grid i 1 grid[i+1][1] grid[i+1] grid i+1 i 1 1 int c = (grid[i][2] - grid[i+1][2]); c (grid[i][2] - grid[i+1][2]) grid[i][2] grid[i] grid i 2 grid[i+1][2] grid[i+1] grid i+1 i 1 2 if (a != b || b != c) { System.out.println("No"); return; } a != b || b != c a != b a b b != c b c { System.out.println("No"); return; } System.out.println("No") System.out.println System.out System System.out "No" return; for (int i = 0; i < 2; i++) {
            int a = (grid[0][i] - grid[0][i+1]);
            int b = (grid[1][i] - grid[1][i+1]);
            int c = (grid[2][i] - grid[2][i+1]);
            if (a != b || b != c) { System.out.println("No"); return; }
        } int i = 0; int i = 0; i 0 i < 2 i 2 i++ i++ i {
            int a = (grid[0][i] - grid[0][i+1]);
            int b = (grid[1][i] - grid[1][i+1]);
            int c = (grid[2][i] - grid[2][i+1]);
            if (a != b || b != c) { System.out.println("No"); return; }
        } {
            int a = (grid[0][i] - grid[0][i+1]);
            int b = (grid[1][i] - grid[1][i+1]);
            int c = (grid[2][i] - grid[2][i+1]);
            if (a != b || b != c) { System.out.println("No"); return; }
        } int a = (grid[0][i] - grid[0][i+1]); a (grid[0][i] - grid[0][i+1]) grid[0][i] grid[0] grid 0 i grid[0][i+1] grid[0] grid 0 i+1 i 1 int b = (grid[1][i] - grid[1][i+1]); b (grid[1][i] - grid[1][i+1]) grid[1][i] grid[1] grid 1 i grid[1][i+1] grid[1] grid 1 i+1 i 1 int c = (grid[2][i] - grid[2][i+1]); c (grid[2][i] - grid[2][i+1]) grid[2][i] grid[2] grid 2 i grid[2][i+1] grid[2] grid 2 i+1 i 1 if (a != b || b != c) { System.out.println("No"); return; } a != b || b != c a != b a b b != c b c { System.out.println("No"); return; } System.out.println("No") System.out.println System.out System System.out "No" return; System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] args args
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int grid[][] = new int[3][3];

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                grid[i][j] = sc.nextInt();
            }
        }

        // 横方向を見る
        for (int i = 0; i < 2; i++) {
            int a = (grid[i][0] - grid[i+1][0]);
            int b = (grid[i][1] - grid[i+1][1]);
            int c = (grid[i][2] - grid[i+1][2]);
            if (a != b || b != c) { System.out.println("No"); return; }
        }

        // 横方向を見る
        for (int i = 0; i < 2; i++) {
            int a = (grid[0][i] - grid[0][i+1]);
            int b = (grid[1][i] - grid[1][i+1]);
            int c = (grid[2][i] - grid[2][i+1]);
            if (a != b || b != c) { System.out.println("No"); return; }
        }

        System.out.println("Yes");
    }
}
