
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int c1 = sc.nextInt();
        int c2 = sc.nextInt();
        int c3 = sc.nextInt();
        int c4 = sc.nextInt();
        int c5 = sc.nextInt();
        int c6 = sc.nextInt();
        int c7 = sc.nextInt();
        int c8 = sc.nextInt();
        int c9 = sc.nextInt();
        int sum1 = c1 + c5 + c9;
        int sum2 = c1 + c6 + c8;
        int sum3 = c2 + c4 + c9;
        int sum4 = c2 + c6 + c7;
        int sum5 = c3 + c4 + c8;
        int sum6 = c3 + c5 + c7;
        if (sum1 == sum2 && sum2 == sum3 && sum3 == sum4 && sum4 == sum5 && sum5 == sum6) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }

} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int c1 = sc.nextInt();
        int c2 = sc.nextInt();
        int c3 = sc.nextInt();
        int c4 = sc.nextInt();
        int c5 = sc.nextInt();
        int c6 = sc.nextInt();
        int c7 = sc.nextInt();
        int c8 = sc.nextInt();
        int c9 = sc.nextInt();
        int sum1 = c1 + c5 + c9;
        int sum2 = c1 + c6 + c8;
        int sum3 = c2 + c4 + c9;
        int sum4 = c2 + c6 + c7;
        int sum5 = c3 + c4 + c8;
        int sum6 = c3 + c5 + c7;
        if (sum1 == sum2 && sum2 == sum3 && sum3 == sum4 && sum4 == sum5 && sum5 == sum6) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int c1 = sc.nextInt();
        int c2 = sc.nextInt();
        int c3 = sc.nextInt();
        int c4 = sc.nextInt();
        int c5 = sc.nextInt();
        int c6 = sc.nextInt();
        int c7 = sc.nextInt();
        int c8 = sc.nextInt();
        int c9 = sc.nextInt();
        int sum1 = c1 + c5 + c9;
        int sum2 = c1 + c6 + c8;
        int sum3 = c2 + c4 + c9;
        int sum4 = c2 + c6 + c7;
        int sum5 = c3 + c4 + c8;
        int sum6 = c3 + c5 + c7;
        if (sum1 == sum2 && sum2 == sum3 && sum3 == sum4 && sum4 == sum5 && sum5 == sum6) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    } main {
        Scanner sc = new Scanner(System.in);
        int c1 = sc.nextInt();
        int c2 = sc.nextInt();
        int c3 = sc.nextInt();
        int c4 = sc.nextInt();
        int c5 = sc.nextInt();
        int c6 = sc.nextInt();
        int c7 = sc.nextInt();
        int c8 = sc.nextInt();
        int c9 = sc.nextInt();
        int sum1 = c1 + c5 + c9;
        int sum2 = c1 + c6 + c8;
        int sum3 = c2 + c4 + c9;
        int sum4 = c2 + c6 + c7;
        int sum5 = c3 + c4 + c8;
        int sum6 = c3 + c5 + c7;
        if (sum1 == sum2 && sum2 == sum3 && sum3 == sum4 && sum4 == sum5 && sum5 == sum6) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int c1 = sc.nextInt(); c1 sc.nextInt() sc.nextInt sc int c2 = sc.nextInt(); c2 sc.nextInt() sc.nextInt sc int c3 = sc.nextInt(); c3 sc.nextInt() sc.nextInt sc int c4 = sc.nextInt(); c4 sc.nextInt() sc.nextInt sc int c5 = sc.nextInt(); c5 sc.nextInt() sc.nextInt sc int c6 = sc.nextInt(); c6 sc.nextInt() sc.nextInt sc int c7 = sc.nextInt(); c7 sc.nextInt() sc.nextInt sc int c8 = sc.nextInt(); c8 sc.nextInt() sc.nextInt sc int c9 = sc.nextInt(); c9 sc.nextInt() sc.nextInt sc int sum1 = c1 + c5 + c9; sum1 c1 + c5 + c9 c1 + c5 + c9 c1 c5 c9 int sum2 = c1 + c6 + c8; sum2 c1 + c6 + c8 c1 + c6 + c8 c1 c6 c8 int sum3 = c2 + c4 + c9; sum3 c2 + c4 + c9 c2 + c4 + c9 c2 c4 c9 int sum4 = c2 + c6 + c7; sum4 c2 + c6 + c7 c2 + c6 + c7 c2 c6 c7 int sum5 = c3 + c4 + c8; sum5 c3 + c4 + c8 c3 + c4 + c8 c3 c4 c8 int sum6 = c3 + c5 + c7; sum6 c3 + c5 + c7 c3 + c5 + c7 c3 c5 c7 if (sum1 == sum2 && sum2 == sum3 && sum3 == sum4 && sum4 == sum5 && sum5 == sum6) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        } sum1 == sum2 && sum2 == sum3 && sum3 == sum4 && sum4 == sum5 && sum5 == sum6 sum4 == sum5 sum3 == sum4 sum1 == sum2 && sum2 == sum3 && sum3 == sum4 && sum4 == sum5 && sum5 == sum6 sum1 == sum2 sum1 sum2 sum2 == sum3 sum2 sum3 sum3 == sum4 sum3 sum4 sum4 == sum5 sum4 sum5 sum5 == sum6 sum5 sum6 {
            System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
            System.out.println("No");
        } System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int c1 = sc.nextInt();
        int c2 = sc.nextInt();
        int c3 = sc.nextInt();
        int c4 = sc.nextInt();
        int c5 = sc.nextInt();
        int c6 = sc.nextInt();
        int c7 = sc.nextInt();
        int c8 = sc.nextInt();
        int c9 = sc.nextInt();
        int sum1 = c1 + c5 + c9;
        int sum2 = c1 + c6 + c8;
        int sum3 = c2 + c4 + c9;
        int sum4 = c2 + c6 + c7;
        int sum5 = c3 + c4 + c8;
        int sum6 = c3 + c5 + c7;
        if (sum1 == sum2 && sum2 == sum3 && sum3 == sum4 && sum4 == sum5 && sum5 == sum6) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }

} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int c1 = sc.nextInt();
        int c2 = sc.nextInt();
        int c3 = sc.nextInt();
        int c4 = sc.nextInt();
        int c5 = sc.nextInt();
        int c6 = sc.nextInt();
        int c7 = sc.nextInt();
        int c8 = sc.nextInt();
        int c9 = sc.nextInt();
        int sum1 = c1 + c5 + c9;
        int sum2 = c1 + c6 + c8;
        int sum3 = c2 + c4 + c9;
        int sum4 = c2 + c6 + c7;
        int sum5 = c3 + c4 + c8;
        int sum6 = c3 + c5 + c7;
        if (sum1 == sum2 && sum2 == sum3 && sum3 == sum4 && sum4 == sum5 && sum5 == sum6) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }

} Main

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int c1 = sc.nextInt();
        int c2 = sc.nextInt();
        int c3 = sc.nextInt();
        int c4 = sc.nextInt();
        int c5 = sc.nextInt();
        int c6 = sc.nextInt();
        int c7 = sc.nextInt();
        int c8 = sc.nextInt();
        int c9 = sc.nextInt();
        int sum1 = c1 + c5 + c9;
        int sum2 = c1 + c6 + c8;
        int sum3 = c2 + c4 + c9;
        int sum4 = c2 + c6 + c7;
        int sum5 = c3 + c4 + c8;
        int sum6 = c3 + c5 + c7;
        if (sum1 == sum2 && sum2 == sum3 && sum3 == sum4 && sum4 == sum5 && sum5 == sum6) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }

}