import java.util.ArrayList;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> cList = new ArrayList<>();
		for(int i = 0 ; i < 9 ; i++) {
			cList.add(sc.nextInt());
		}
		if(!verticalCheck(cList, 0) || !verticalCheck(cList, 3)) {
			System.out.println("No");
			return;
		}

		if(!horizonCheck(cList, 0) || !horizonCheck(cList, 1)) {
			System.out.println("No");
			return;
		}
		System.out.println("Yes");

	}

	private static boolean verticalCheck(ArrayList<Integer> cList, Integer start) {
		Integer v1 = cList.get(start + 3) - cList.get(start);
		Integer v2 = cList.get(start + 4) - cList.get(start + 1);
		Integer v3 = cList.get(start + 5) - cList.get(start + 2);
		return v1 == v2 && v2 == v3;
	}

	private static boolean horizonCheck(ArrayList<Integer> cList, Integer start) {
		Integer v1 = cList.get(start + 1) - cList.get(start);
		Integer v2 = cList.get(start + 4) - cList.get(start + 3);
		Integer v3 = cList.get(start + 7) - cList.get(start + 6);
		return v1 == v2 && v2 == v3;
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> cList = new ArrayList<>();
		for(int i = 0 ; i < 9 ; i++) {
			cList.add(sc.nextInt());
		}
		if(!verticalCheck(cList, 0) || !verticalCheck(cList, 3)) {
			System.out.println("No");
			return;
		}

		if(!horizonCheck(cList, 0) || !horizonCheck(cList, 1)) {
			System.out.println("No");
			return;
		}
		System.out.println("Yes");

	}

	private static boolean verticalCheck(ArrayList<Integer> cList, Integer start) {
		Integer v1 = cList.get(start + 3) - cList.get(start);
		Integer v2 = cList.get(start + 4) - cList.get(start + 1);
		Integer v3 = cList.get(start + 5) - cList.get(start + 2);
		return v1 == v2 && v2 == v3;
	}

	private static boolean horizonCheck(ArrayList<Integer> cList, Integer start) {
		Integer v1 = cList.get(start + 1) - cList.get(start);
		Integer v2 = cList.get(start + 4) - cList.get(start + 3);
		Integer v3 = cList.get(start + 7) - cList.get(start + 6);
		return v1 == v2 && v2 == v3;
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> cList = new ArrayList<>();
		for(int i = 0 ; i < 9 ; i++) {
			cList.add(sc.nextInt());
		}
		if(!verticalCheck(cList, 0) || !verticalCheck(cList, 3)) {
			System.out.println("No");
			return;
		}

		if(!horizonCheck(cList, 0) || !horizonCheck(cList, 1)) {
			System.out.println("No");
			return;
		}
		System.out.println("Yes");

	} main {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> cList = new ArrayList<>();
		for(int i = 0 ; i < 9 ; i++) {
			cList.add(sc.nextInt());
		}
		if(!verticalCheck(cList, 0) || !verticalCheck(cList, 3)) {
			System.out.println("No");
			return;
		}

		if(!horizonCheck(cList, 0) || !horizonCheck(cList, 1)) {
			System.out.println("No");
			return;
		}
		System.out.println("Yes");

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) ArrayList<Integer> cList = new ArrayList<>(); cList new ArrayList<>() for(int i = 0 ; i < 9 ; i++) {
			cList.add(sc.nextInt());
		} int i = 0 ; int i = 0 ; i 0 i < 9 i 9 i++ i++ i {
			cList.add(sc.nextInt());
		} {
			cList.add(sc.nextInt());
		} cList.add(sc.nextInt()) cList.add cList sc.nextInt() sc.nextInt sc if(!verticalCheck(cList, 0) || !verticalCheck(cList, 3)) {
			System.out.println("No");
			return;
		} !verticalCheck(cList, 0) || !verticalCheck(cList, 3) !verticalCheck(cList, 0) verticalCheck(cList, 0) verticalCheck cList 0 !verticalCheck(cList, 3) verticalCheck(cList, 3) verticalCheck cList 3 {
			System.out.println("No");
			return;
		} System.out.println("No") System.out.println System.out System System.out "No" return; if(!horizonCheck(cList, 0) || !horizonCheck(cList, 1)) {
			System.out.println("No");
			return;
		} !horizonCheck(cList, 0) || !horizonCheck(cList, 1) !horizonCheck(cList, 0) horizonCheck(cList, 0) horizonCheck cList 0 !horizonCheck(cList, 1) horizonCheck(cList, 1) horizonCheck cList 1 {
			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 private static boolean verticalCheck(ArrayList<Integer> cList, Integer start) {
		Integer v1 = cList.get(start + 3) - cList.get(start);
		Integer v2 = cList.get(start + 4) - cList.get(start + 1);
		Integer v3 = cList.get(start + 5) - cList.get(start + 2);
		return v1 == v2 && v2 == v3;
	} verticalCheck {
		Integer v1 = cList.get(start + 3) - cList.get(start);
		Integer v2 = cList.get(start + 4) - cList.get(start + 1);
		Integer v3 = cList.get(start + 5) - cList.get(start + 2);
		return v1 == v2 && v2 == v3;
	} Integer v1 = cList.get(start + 3) - cList.get(start); v1 cList.get(start + 3) - cList.get(start) cList.get(start + 3) cList.get cList start + 3 start 3 cList.get(start) cList.get cList start Integer v2 = cList.get(start + 4) - cList.get(start + 1); v2 cList.get(start + 4) - cList.get(start + 1) cList.get(start + 4) cList.get cList start + 4 start 4 cList.get(start + 1) cList.get cList start + 1 start 1 Integer v3 = cList.get(start + 5) - cList.get(start + 2); v3 cList.get(start + 5) - cList.get(start + 2) cList.get(start + 5) cList.get cList start + 5 start 5 cList.get(start + 2) cList.get cList start + 2 start 2 return v1 == v2 && v2 == v3; v1 == v2 && v2 == v3 v1 == v2 v1 v2 v2 == v3 v2 v3 ArrayList<Integer> cList cList Integer start start private static boolean horizonCheck(ArrayList<Integer> cList, Integer start) {
		Integer v1 = cList.get(start + 1) - cList.get(start);
		Integer v2 = cList.get(start + 4) - cList.get(start + 3);
		Integer v3 = cList.get(start + 7) - cList.get(start + 6);
		return v1 == v2 && v2 == v3;
	} horizonCheck {
		Integer v1 = cList.get(start + 1) - cList.get(start);
		Integer v2 = cList.get(start + 4) - cList.get(start + 3);
		Integer v3 = cList.get(start + 7) - cList.get(start + 6);
		return v1 == v2 && v2 == v3;
	} Integer v1 = cList.get(start + 1) - cList.get(start); v1 cList.get(start + 1) - cList.get(start) cList.get(start + 1) cList.get cList start + 1 start 1 cList.get(start) cList.get cList start Integer v2 = cList.get(start + 4) - cList.get(start + 3); v2 cList.get(start + 4) - cList.get(start + 3) cList.get(start + 4) cList.get cList start + 4 start 4 cList.get(start + 3) cList.get cList start + 3 start 3 Integer v3 = cList.get(start + 7) - cList.get(start + 6); v3 cList.get(start + 7) - cList.get(start + 6) cList.get(start + 7) cList.get cList start + 7 start 7 cList.get(start + 6) cList.get cList start + 6 start 6 return v1 == v2 && v2 == v3; v1 == v2 && v2 == v3 v1 == v2 v1 v2 v2 == v3 v2 v3 ArrayList<Integer> cList cList Integer start start public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> cList = new ArrayList<>();
		for(int i = 0 ; i < 9 ; i++) {
			cList.add(sc.nextInt());
		}
		if(!verticalCheck(cList, 0) || !verticalCheck(cList, 3)) {
			System.out.println("No");
			return;
		}

		if(!horizonCheck(cList, 0) || !horizonCheck(cList, 1)) {
			System.out.println("No");
			return;
		}
		System.out.println("Yes");

	}

	private static boolean verticalCheck(ArrayList<Integer> cList, Integer start) {
		Integer v1 = cList.get(start + 3) - cList.get(start);
		Integer v2 = cList.get(start + 4) - cList.get(start + 1);
		Integer v3 = cList.get(start + 5) - cList.get(start + 2);
		return v1 == v2 && v2 == v3;
	}

	private static boolean horizonCheck(ArrayList<Integer> cList, Integer start) {
		Integer v1 = cList.get(start + 1) - cList.get(start);
		Integer v2 = cList.get(start + 4) - cList.get(start + 3);
		Integer v3 = cList.get(start + 7) - cList.get(start + 6);
		return v1 == v2 && v2 == v3;
	}
} public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> cList = new ArrayList<>();
		for(int i = 0 ; i < 9 ; i++) {
			cList.add(sc.nextInt());
		}
		if(!verticalCheck(cList, 0) || !verticalCheck(cList, 3)) {
			System.out.println("No");
			return;
		}

		if(!horizonCheck(cList, 0) || !horizonCheck(cList, 1)) {
			System.out.println("No");
			return;
		}
		System.out.println("Yes");

	}

	private static boolean verticalCheck(ArrayList<Integer> cList, Integer start) {
		Integer v1 = cList.get(start + 3) - cList.get(start);
		Integer v2 = cList.get(start + 4) - cList.get(start + 1);
		Integer v3 = cList.get(start + 5) - cList.get(start + 2);
		return v1 == v2 && v2 == v3;
	}

	private static boolean horizonCheck(ArrayList<Integer> cList, Integer start) {
		Integer v1 = cList.get(start + 1) - cList.get(start);
		Integer v2 = cList.get(start + 4) - cList.get(start + 3);
		Integer v3 = cList.get(start + 7) - cList.get(start + 6);
		return v1 == v2 && v2 == v3;
	}
} Main
import java.util.ArrayList;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> cList = new ArrayList<>();
		for(int i = 0 ; i < 9 ; i++) {
			cList.add(sc.nextInt());
		}
		if(!verticalCheck(cList, 0) || !verticalCheck(cList, 3)) {
			System.out.println("No");
			return;
		}

		if(!horizonCheck(cList, 0) || !horizonCheck(cList, 1)) {
			System.out.println("No");
			return;
		}
		System.out.println("Yes");

	}

	private static boolean verticalCheck(ArrayList<Integer> cList, Integer start) {
		Integer v1 = cList.get(start + 3) - cList.get(start);
		Integer v2 = cList.get(start + 4) - cList.get(start + 1);
		Integer v3 = cList.get(start + 5) - cList.get(start + 2);
		return v1 == v2 && v2 == v3;
	}

	private static boolean horizonCheck(ArrayList<Integer> cList, Integer start) {
		Integer v1 = cList.get(start + 1) - cList.get(start);
		Integer v2 = cList.get(start + 4) - cList.get(start + 3);
		Integer v3 = cList.get(start + 7) - cList.get(start + 6);
		return v1 == v2 && v2 == v3;
	}
}