import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int w_diffs[] = new int[2];
    int h_diffs[] = new int[2];
    int m[][] = new int[3][3];
    boolean con = true;
    
    
    for(int i = 0; i < 3; i++) {
      for(int j = 0; j < 3; j++) {
        m[i][j] = sc.nextInt();
      }
    }
    
    w_diffs[0] = m[0][1] - m[0][0];
    w_diffs[1] = m[0][2] - m[0][1];
    
    h_diffs[0] = m[1][0] - m[0][0];
    h_diffs[1] = m[2][0] - m[1][0];
    
    for(int i = 1; i < 3 && con; i++){
      for(int j = 0; j < 2; j++){
      	if(m[i][j+1] - m[i][j] != w_diffs[j]) con = false;
        if(m[j+1][i] - m[j][i] != h_diffs[j]) con = false;
      }
    }
        
    if(con) System.out.println("Yes");
    else System.out.println("No");
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int w_diffs[] = new int[2];
    int h_diffs[] = new int[2];
    int m[][] = new int[3][3];
    boolean con = true;
    
    
    for(int i = 0; i < 3; i++) {
      for(int j = 0; j < 3; j++) {
        m[i][j] = sc.nextInt();
      }
    }
    
    w_diffs[0] = m[0][1] - m[0][0];
    w_diffs[1] = m[0][2] - m[0][1];
    
    h_diffs[0] = m[1][0] - m[0][0];
    h_diffs[1] = m[2][0] - m[1][0];
    
    for(int i = 1; i < 3 && con; i++){
      for(int j = 0; j < 2; j++){
      	if(m[i][j+1] - m[i][j] != w_diffs[j]) con = false;
        if(m[j+1][i] - m[j][i] != h_diffs[j]) con = false;
      }
    }
        
    if(con) System.out.println("Yes");
    else System.out.println("No");
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int w_diffs[] = new int[2];
    int h_diffs[] = new int[2];
    int m[][] = new int[3][3];
    boolean con = true;
    
    
    for(int i = 0; i < 3; i++) {
      for(int j = 0; j < 3; j++) {
        m[i][j] = sc.nextInt();
      }
    }
    
    w_diffs[0] = m[0][1] - m[0][0];
    w_diffs[1] = m[0][2] - m[0][1];
    
    h_diffs[0] = m[1][0] - m[0][0];
    h_diffs[1] = m[2][0] - m[1][0];
    
    for(int i = 1; i < 3 && con; i++){
      for(int j = 0; j < 2; j++){
      	if(m[i][j+1] - m[i][j] != w_diffs[j]) con = false;
        if(m[j+1][i] - m[j][i] != h_diffs[j]) con = false;
      }
    }
        
    if(con) System.out.println("Yes");
    else System.out.println("No");
  } main {
    Scanner sc = new Scanner(System.in);
    int w_diffs[] = new int[2];
    int h_diffs[] = new int[2];
    int m[][] = new int[3][3];
    boolean con = true;
    
    
    for(int i = 0; i < 3; i++) {
      for(int j = 0; j < 3; j++) {
        m[i][j] = sc.nextInt();
      }
    }
    
    w_diffs[0] = m[0][1] - m[0][0];
    w_diffs[1] = m[0][2] - m[0][1];
    
    h_diffs[0] = m[1][0] - m[0][0];
    h_diffs[1] = m[2][0] - m[1][0];
    
    for(int i = 1; i < 3 && con; i++){
      for(int j = 0; j < 2; j++){
      	if(m[i][j+1] - m[i][j] != w_diffs[j]) con = false;
        if(m[j+1][i] - m[j][i] != h_diffs[j]) con = false;
      }
    }
        
    if(con) System.out.println("Yes");
    else System.out.println("No");
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int w_diffs[] = new int[2]; w_diffs new int[2] 2 int h_diffs[] = new int[2]; h_diffs new int[2] 2 int m[][] = new int[3][3]; m new int[3][3] 3 3 boolean con = true; con true for(int i = 0; i < 3; i++) {
      for(int j = 0; j < 3; j++) {
        m[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++) {
        m[i][j] = sc.nextInt();
      }
    } {
      for(int j = 0; j < 3; j++) {
        m[i][j] = sc.nextInt();
      }
    } for(int j = 0; j < 3; j++) {
        m[i][j] = sc.nextInt();
      } int j = 0; int j = 0; j 0 j < 3 j 3 j++ j++ j {
        m[i][j] = sc.nextInt();
      } {
        m[i][j] = sc.nextInt();
      } m[i][j] = sc.nextInt() m[i][j] m[i] m i j sc.nextInt() sc.nextInt sc w_diffs[0] = m[0][1] - m[0][0] w_diffs[0] w_diffs 0 m[0][1] - m[0][0] m[0][1] m[0] m 0 1 m[0][0] m[0] m 0 0 w_diffs[1] = m[0][2] - m[0][1] w_diffs[1] w_diffs 1 m[0][2] - m[0][1] m[0][2] m[0] m 0 2 m[0][1] m[0] m 0 1 h_diffs[0] = m[1][0] - m[0][0] h_diffs[0] h_diffs 0 m[1][0] - m[0][0] m[1][0] m[1] m 1 0 m[0][0] m[0] m 0 0 h_diffs[1] = m[2][0] - m[1][0] h_diffs[1] h_diffs 1 m[2][0] - m[1][0] m[2][0] m[2] m 2 0 m[1][0] m[1] m 1 0 for(int i = 1; i < 3 && con; i++){
      for(int j = 0; j < 2; j++){
      	if(m[i][j+1] - m[i][j] != w_diffs[j]) con = false;
        if(m[j+1][i] - m[j][i] != h_diffs[j]) con = false;
      }
    } int i = 1; int i = 1; i 1 i < 3 && con i < 3 i 3 con i++ i++ i {
      for(int j = 0; j < 2; j++){
      	if(m[i][j+1] - m[i][j] != w_diffs[j]) con = false;
        if(m[j+1][i] - m[j][i] != h_diffs[j]) con = false;
      }
    } {
      for(int j = 0; j < 2; j++){
      	if(m[i][j+1] - m[i][j] != w_diffs[j]) con = false;
        if(m[j+1][i] - m[j][i] != h_diffs[j]) con = false;
      }
    } for(int j = 0; j < 2; j++){
      	if(m[i][j+1] - m[i][j] != w_diffs[j]) con = false;
        if(m[j+1][i] - m[j][i] != h_diffs[j]) con = false;
      } int j = 0; int j = 0; j 0 j < 2 j 2 j++ j++ j {
      	if(m[i][j+1] - m[i][j] != w_diffs[j]) con = false;
        if(m[j+1][i] - m[j][i] != h_diffs[j]) con = false;
      } {
      	if(m[i][j+1] - m[i][j] != w_diffs[j]) con = false;
        if(m[j+1][i] - m[j][i] != h_diffs[j]) con = false;
      } if(m[i][j+1] - m[i][j] != w_diffs[j]) con = false; m[i][j+1] - m[i][j] != w_diffs[j] m[i][j+1] - m[i][j] m[i][j+1] m[i] m i j+1 j 1 m[i][j] m[i] m i j w_diffs[j] w_diffs j con = false con false if(m[j+1][i] - m[j][i] != h_diffs[j]) con = false; m[j+1][i] - m[j][i] != h_diffs[j] m[j+1][i] - m[j][i] m[j+1][i] m[j+1] m j+1 j 1 i m[j][i] m[j] m j i h_diffs[j] h_diffs j con = false con false if(con) System.out.println("Yes");
    else System.out.println("No"); con System.out.println("Yes") System.out.println System.out System System.out "Yes" 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 w_diffs[] = new int[2];
    int h_diffs[] = new int[2];
    int m[][] = new int[3][3];
    boolean con = true;
    
    
    for(int i = 0; i < 3; i++) {
      for(int j = 0; j < 3; j++) {
        m[i][j] = sc.nextInt();
      }
    }
    
    w_diffs[0] = m[0][1] - m[0][0];
    w_diffs[1] = m[0][2] - m[0][1];
    
    h_diffs[0] = m[1][0] - m[0][0];
    h_diffs[1] = m[2][0] - m[1][0];
    
    for(int i = 1; i < 3 && con; i++){
      for(int j = 0; j < 2; j++){
      	if(m[i][j+1] - m[i][j] != w_diffs[j]) con = false;
        if(m[j+1][i] - m[j][i] != h_diffs[j]) con = false;
      }
    }
        
    if(con) 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 w_diffs[] = new int[2];
    int h_diffs[] = new int[2];
    int m[][] = new int[3][3];
    boolean con = true;
    
    
    for(int i = 0; i < 3; i++) {
      for(int j = 0; j < 3; j++) {
        m[i][j] = sc.nextInt();
      }
    }
    
    w_diffs[0] = m[0][1] - m[0][0];
    w_diffs[1] = m[0][2] - m[0][1];
    
    h_diffs[0] = m[1][0] - m[0][0];
    h_diffs[1] = m[2][0] - m[1][0];
    
    for(int i = 1; i < 3 && con; i++){
      for(int j = 0; j < 2; j++){
      	if(m[i][j+1] - m[i][j] != w_diffs[j]) con = false;
        if(m[j+1][i] - m[j][i] != h_diffs[j]) con = false;
      }
    }
        
    if(con) System.out.println("Yes");
    else System.out.println("No");
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int w_diffs[] = new int[2];
    int h_diffs[] = new int[2];
    int m[][] = new int[3][3];
    boolean con = true;
    
    
    for(int i = 0; i < 3; i++) {
      for(int j = 0; j < 3; j++) {
        m[i][j] = sc.nextInt();
      }
    }
    
    w_diffs[0] = m[0][1] - m[0][0];
    w_diffs[1] = m[0][2] - m[0][1];
    
    h_diffs[0] = m[1][0] - m[0][0];
    h_diffs[1] = m[2][0] - m[1][0];
    
    for(int i = 1; i < 3 && con; i++){
      for(int j = 0; j < 2; j++){
      	if(m[i][j+1] - m[i][j] != w_diffs[j]) con = false;
        if(m[j+1][i] - m[j][i] != h_diffs[j]) con = false;
      }
    }
        
    if(con) System.out.println("Yes");
    else System.out.println("No");
  }
}
