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

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// すべてのマスに入った値を取得
		ArrayList<Integer> all = new ArrayList<Integer>();
		for(int i = 0; i < 9 ; i++){
			all.add(sc.nextInt());
		}
		boolean takahashi = true;
		// test1
		Integer diff1 = all.get(3) - all.get(0);
		Integer diff2 = all.get(4) - all.get(1);
		Integer diff3 = all.get(5) - all.get(2);
		if(diff1 != diff2){
			takahashi = false;
		}else if(diff1 != diff3){
			takahashi = false;
		}
		// test2
		if(takahashi){
			diff1 = all.get(6) - all.get(3);
			diff2 = all.get(7) - all.get(4);
			diff3 = all.get(8) - all.get(5);
			if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			}
		}
		// test3
		if(takahashi){
			diff1 = all.get(1) - all.get(0);
			diff2 = all.get(4) - all.get(3);
			diff3 = all.get(7) - all.get(6);
			if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			}
		}
		// test4
		if(takahashi){
			diff1 = all.get(2) - all.get(1);
			diff2 = all.get(5) - all.get(4);
			diff3 = all.get(8) - all.get(7);
			if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			}
		}
		if(takahashi){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// すべてのマスに入った値を取得
		ArrayList<Integer> all = new ArrayList<Integer>();
		for(int i = 0; i < 9 ; i++){
			all.add(sc.nextInt());
		}
		boolean takahashi = true;
		// test1
		Integer diff1 = all.get(3) - all.get(0);
		Integer diff2 = all.get(4) - all.get(1);
		Integer diff3 = all.get(5) - all.get(2);
		if(diff1 != diff2){
			takahashi = false;
		}else if(diff1 != diff3){
			takahashi = false;
		}
		// test2
		if(takahashi){
			diff1 = all.get(6) - all.get(3);
			diff2 = all.get(7) - all.get(4);
			diff3 = all.get(8) - all.get(5);
			if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			}
		}
		// test3
		if(takahashi){
			diff1 = all.get(1) - all.get(0);
			diff2 = all.get(4) - all.get(3);
			diff3 = all.get(7) - all.get(6);
			if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			}
		}
		// test4
		if(takahashi){
			diff1 = all.get(2) - all.get(1);
			diff2 = all.get(5) - all.get(4);
			diff3 = all.get(8) - all.get(7);
			if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			}
		}
		if(takahashi){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// すべてのマスに入った値を取得
		ArrayList<Integer> all = new ArrayList<Integer>();
		for(int i = 0; i < 9 ; i++){
			all.add(sc.nextInt());
		}
		boolean takahashi = true;
		// test1
		Integer diff1 = all.get(3) - all.get(0);
		Integer diff2 = all.get(4) - all.get(1);
		Integer diff3 = all.get(5) - all.get(2);
		if(diff1 != diff2){
			takahashi = false;
		}else if(diff1 != diff3){
			takahashi = false;
		}
		// test2
		if(takahashi){
			diff1 = all.get(6) - all.get(3);
			diff2 = all.get(7) - all.get(4);
			diff3 = all.get(8) - all.get(5);
			if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			}
		}
		// test3
		if(takahashi){
			diff1 = all.get(1) - all.get(0);
			diff2 = all.get(4) - all.get(3);
			diff3 = all.get(7) - all.get(6);
			if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			}
		}
		// test4
		if(takahashi){
			diff1 = all.get(2) - all.get(1);
			diff2 = all.get(5) - all.get(4);
			diff3 = all.get(8) - all.get(7);
			if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			}
		}
		if(takahashi){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	} main {
		Scanner sc = new Scanner(System.in);
		// すべてのマスに入った値を取得
		ArrayList<Integer> all = new ArrayList<Integer>();
		for(int i = 0; i < 9 ; i++){
			all.add(sc.nextInt());
		}
		boolean takahashi = true;
		// test1
		Integer diff1 = all.get(3) - all.get(0);
		Integer diff2 = all.get(4) - all.get(1);
		Integer diff3 = all.get(5) - all.get(2);
		if(diff1 != diff2){
			takahashi = false;
		}else if(diff1 != diff3){
			takahashi = false;
		}
		// test2
		if(takahashi){
			diff1 = all.get(6) - all.get(3);
			diff2 = all.get(7) - all.get(4);
			diff3 = all.get(8) - all.get(5);
			if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			}
		}
		// test3
		if(takahashi){
			diff1 = all.get(1) - all.get(0);
			diff2 = all.get(4) - all.get(3);
			diff3 = all.get(7) - all.get(6);
			if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			}
		}
		// test4
		if(takahashi){
			diff1 = all.get(2) - all.get(1);
			diff2 = all.get(5) - all.get(4);
			diff3 = all.get(8) - all.get(7);
			if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			}
		}
		if(takahashi){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) ArrayList<Integer> all = new ArrayList<Integer>(); all new ArrayList<Integer>() for(int i = 0; i < 9 ; i++){
			all.add(sc.nextInt());
		} int i = 0; int i = 0; i 0 i < 9 i 9 i++ i++ i {
			all.add(sc.nextInt());
		} {
			all.add(sc.nextInt());
		} all.add(sc.nextInt()) all.add all sc.nextInt() sc.nextInt sc boolean takahashi = true; takahashi true Integer diff1 = all.get(3) - all.get(0); diff1 all.get(3) - all.get(0) all.get(3) all.get all 3 all.get(0) all.get all 0 Integer diff2 = all.get(4) - all.get(1); diff2 all.get(4) - all.get(1) all.get(4) all.get all 4 all.get(1) all.get all 1 Integer diff3 = all.get(5) - all.get(2); diff3 all.get(5) - all.get(2) all.get(5) all.get all 5 all.get(2) all.get all 2 if(diff1 != diff2){
			takahashi = false;
		}else if(diff1 != diff3){
			takahashi = false;
		} diff1 != diff2 diff1 diff2 {
			takahashi = false;
		} takahashi = false takahashi false if(diff1 != diff3){
			takahashi = false;
		} diff1 != diff3 diff1 diff3 {
			takahashi = false;
		} takahashi = false takahashi false if(takahashi){
			diff1 = all.get(6) - all.get(3);
			diff2 = all.get(7) - all.get(4);
			diff3 = all.get(8) - all.get(5);
			if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			}
		} takahashi {
			diff1 = all.get(6) - all.get(3);
			diff2 = all.get(7) - all.get(4);
			diff3 = all.get(8) - all.get(5);
			if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			}
		} diff1 = all.get(6) - all.get(3) diff1 all.get(6) - all.get(3) all.get(6) all.get all 6 all.get(3) all.get all 3 diff2 = all.get(7) - all.get(4) diff2 all.get(7) - all.get(4) all.get(7) all.get all 7 all.get(4) all.get all 4 diff3 = all.get(8) - all.get(5) diff3 all.get(8) - all.get(5) all.get(8) all.get all 8 all.get(5) all.get all 5 if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			} diff1 != diff2 diff1 diff2 {
				takahashi = false;
			} takahashi = false takahashi false if(diff1 != diff3){
				takahashi = false;
			} diff1 != diff3 diff1 diff3 {
				takahashi = false;
			} takahashi = false takahashi false if(takahashi){
			diff1 = all.get(1) - all.get(0);
			diff2 = all.get(4) - all.get(3);
			diff3 = all.get(7) - all.get(6);
			if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			}
		} takahashi {
			diff1 = all.get(1) - all.get(0);
			diff2 = all.get(4) - all.get(3);
			diff3 = all.get(7) - all.get(6);
			if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			}
		} diff1 = all.get(1) - all.get(0) diff1 all.get(1) - all.get(0) all.get(1) all.get all 1 all.get(0) all.get all 0 diff2 = all.get(4) - all.get(3) diff2 all.get(4) - all.get(3) all.get(4) all.get all 4 all.get(3) all.get all 3 diff3 = all.get(7) - all.get(6) diff3 all.get(7) - all.get(6) all.get(7) all.get all 7 all.get(6) all.get all 6 if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			} diff1 != diff2 diff1 diff2 {
				takahashi = false;
			} takahashi = false takahashi false if(diff1 != diff3){
				takahashi = false;
			} diff1 != diff3 diff1 diff3 {
				takahashi = false;
			} takahashi = false takahashi false if(takahashi){
			diff1 = all.get(2) - all.get(1);
			diff2 = all.get(5) - all.get(4);
			diff3 = all.get(8) - all.get(7);
			if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			}
		} takahashi {
			diff1 = all.get(2) - all.get(1);
			diff2 = all.get(5) - all.get(4);
			diff3 = all.get(8) - all.get(7);
			if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			}
		} diff1 = all.get(2) - all.get(1) diff1 all.get(2) - all.get(1) all.get(2) all.get all 2 all.get(1) all.get all 1 diff2 = all.get(5) - all.get(4) diff2 all.get(5) - all.get(4) all.get(5) all.get all 5 all.get(4) all.get all 4 diff3 = all.get(8) - all.get(7) diff3 all.get(8) - all.get(7) all.get(8) all.get all 8 all.get(7) all.get all 7 if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			} diff1 != diff2 diff1 diff2 {
				takahashi = false;
			} takahashi = false takahashi false if(diff1 != diff3){
				takahashi = false;
			} diff1 != diff3 diff1 diff3 {
				takahashi = false;
			} takahashi = false takahashi false if(takahashi){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		} takahashi {
			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
import java.util.ArrayList;
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// すべてのマスに入った値を取得
		ArrayList<Integer> all = new ArrayList<Integer>();
		for(int i = 0; i < 9 ; i++){
			all.add(sc.nextInt());
		}
		boolean takahashi = true;
		// test1
		Integer diff1 = all.get(3) - all.get(0);
		Integer diff2 = all.get(4) - all.get(1);
		Integer diff3 = all.get(5) - all.get(2);
		if(diff1 != diff2){
			takahashi = false;
		}else if(diff1 != diff3){
			takahashi = false;
		}
		// test2
		if(takahashi){
			diff1 = all.get(6) - all.get(3);
			diff2 = all.get(7) - all.get(4);
			diff3 = all.get(8) - all.get(5);
			if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			}
		}
		// test3
		if(takahashi){
			diff1 = all.get(1) - all.get(0);
			diff2 = all.get(4) - all.get(3);
			diff3 = all.get(7) - all.get(6);
			if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			}
		}
		// test4
		if(takahashi){
			diff1 = all.get(2) - all.get(1);
			diff2 = all.get(5) - all.get(4);
			diff3 = all.get(8) - all.get(7);
			if(diff1 != diff2){
				takahashi = false;
			}else if(diff1 != diff3){
				takahashi = false;
			}
		}
		if(takahashi){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}