import java.util.*;

public class Main {
  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      int[][] arr = new int[3][3];
      int[] a = new int[3];//𝑎1, 𝑎2, 𝑎3,
      int[] b = new int[3];//𝑏1, 𝑏2, 𝑏3
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          arr[i][j] = sc.nextInt();
        }
      }

      // 1つ分かれば（ex. 𝑎1=xと仮定すると）他のa,bもxの式で表せられる
      // それで、a1=x+?=0となるxがあるとすると、a1=と仮定して他のa,bもxの式で表せられる・・・はず
      a[0] = 0;
      for (int i = 0; i < 3; i++)
        b[i] = arr[0][i] - a[0];// 𝑏𝑖 = 𝑐1,𝑖 − 𝑎1
      for (int i = 0; i < 3; i++)
        a[i] = arr[i][0] - b[0];

      boolean isGood = true;
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          if (arr[i][j] != a[i] + b[j]) {
            isGood = false;
          }
        }
      }
      System.out.println(isGood ? "Yes" : "No");
    }

  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      int[][] arr = new int[3][3];
      int[] a = new int[3];//𝑎1, 𝑎2, 𝑎3,
      int[] b = new int[3];//𝑏1, 𝑏2, 𝑏3
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          arr[i][j] = sc.nextInt();
        }
      }

      // 1つ分かれば（ex. 𝑎1=xと仮定すると）他のa,bもxの式で表せられる
      // それで、a1=x+?=0となるxがあるとすると、a1=と仮定して他のa,bもxの式で表せられる・・・はず
      a[0] = 0;
      for (int i = 0; i < 3; i++)
        b[i] = arr[0][i] - a[0];// 𝑏𝑖 = 𝑐1,𝑖 − 𝑎1
      for (int i = 0; i < 3; i++)
        a[i] = arr[i][0] - b[0];

      boolean isGood = true;
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          if (arr[i][j] != a[i] + b[j]) {
            isGood = false;
          }
        }
      }
      System.out.println(isGood ? "Yes" : "No");
    }

  }
} Main public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      int[][] arr = new int[3][3];
      int[] a = new int[3];//𝑎1, 𝑎2, 𝑎3,
      int[] b = new int[3];//𝑏1, 𝑏2, 𝑏3
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          arr[i][j] = sc.nextInt();
        }
      }

      // 1つ分かれば（ex. 𝑎1=xと仮定すると）他のa,bもxの式で表せられる
      // それで、a1=x+?=0となるxがあるとすると、a1=と仮定して他のa,bもxの式で表せられる・・・はず
      a[0] = 0;
      for (int i = 0; i < 3; i++)
        b[i] = arr[0][i] - a[0];// 𝑏𝑖 = 𝑐1,𝑖 − 𝑎1
      for (int i = 0; i < 3; i++)
        a[i] = arr[i][0] - b[0];

      boolean isGood = true;
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          if (arr[i][j] != a[i] + b[j]) {
            isGood = false;
          }
        }
      }
      System.out.println(isGood ? "Yes" : "No");
    }

  } main {
    try (Scanner sc = new Scanner(System.in)) {
      int[][] arr = new int[3][3];
      int[] a = new int[3];//𝑎1, 𝑎2, 𝑎3,
      int[] b = new int[3];//𝑏1, 𝑏2, 𝑏3
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          arr[i][j] = sc.nextInt();
        }
      }

      // 1つ分かれば（ex. 𝑎1=xと仮定すると）他のa,bもxの式で表せられる
      // それで、a1=x+?=0となるxがあるとすると、a1=と仮定して他のa,bもxの式で表せられる・・・はず
      a[0] = 0;
      for (int i = 0; i < 3; i++)
        b[i] = arr[0][i] - a[0];// 𝑏𝑖 = 𝑐1,𝑖 − 𝑎1
      for (int i = 0; i < 3; i++)
        a[i] = arr[i][0] - b[0];

      boolean isGood = true;
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          if (arr[i][j] != a[i] + b[j]) {
            isGood = false;
          }
        }
      }
      System.out.println(isGood ? "Yes" : "No");
    }

  } try (Scanner sc = new Scanner(System.in)) {
      int[][] arr = new int[3][3];
      int[] a = new int[3];//𝑎1, 𝑎2, 𝑎3,
      int[] b = new int[3];//𝑏1, 𝑏2, 𝑏3
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          arr[i][j] = sc.nextInt();
        }
      }

      // 1つ分かれば（ex. 𝑎1=xと仮定すると）他のa,bもxの式で表せられる
      // それで、a1=x+?=0となるxがあるとすると、a1=と仮定して他のa,bもxの式で表せられる・・・はず
      a[0] = 0;
      for (int i = 0; i < 3; i++)
        b[i] = arr[0][i] - a[0];// 𝑏𝑖 = 𝑐1,𝑖 − 𝑎1
      for (int i = 0; i < 3; i++)
        a[i] = arr[i][0] - b[0];

      boolean isGood = true;
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          if (arr[i][j] != a[i] + b[j]) {
            isGood = false;
          }
        }
      }
      System.out.println(isGood ? "Yes" : "No");
    } {
      int[][] arr = new int[3][3];
      int[] a = new int[3];//𝑎1, 𝑎2, 𝑎3,
      int[] b = new int[3];//𝑏1, 𝑏2, 𝑏3
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          arr[i][j] = sc.nextInt();
        }
      }

      // 1つ分かれば（ex. 𝑎1=xと仮定すると）他のa,bもxの式で表せられる
      // それで、a1=x+?=0となるxがあるとすると、a1=と仮定して他のa,bもxの式で表せられる・・・はず
      a[0] = 0;
      for (int i = 0; i < 3; i++)
        b[i] = arr[0][i] - a[0];// 𝑏𝑖 = 𝑐1,𝑖 − 𝑎1
      for (int i = 0; i < 3; i++)
        a[i] = arr[i][0] - b[0];

      boolean isGood = true;
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          if (arr[i][j] != a[i] + b[j]) {
            isGood = false;
          }
        }
      }
      System.out.println(isGood ? "Yes" : "No");
    } Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) int[][] arr = new int[3][3]; arr new int[3][3] 3 3 int[] a = new int[3]; a new int[3] 3 int[] b = new int[3]; b new int[3] 3 for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          arr[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++) {
          arr[i][j] = sc.nextInt();
        }
      } {
        for (int j = 0; j < 3; j++) {
          arr[i][j] = sc.nextInt();
        }
      } for (int j = 0; j < 3; j++) {
          arr[i][j] = sc.nextInt();
        } int j = 0; int j = 0; j 0 j < 3 j 3 j++ j++ j {
          arr[i][j] = sc.nextInt();
        } {
          arr[i][j] = sc.nextInt();
        } arr[i][j] = sc.nextInt() arr[i][j] arr[i] arr i j sc.nextInt() sc.nextInt sc a[0] = 0 a[0] a 0 0 for (int i = 0; i < 3; i++)
        b[i] = arr[0][i] - a[0];// 𝑏𝑖 = 𝑐1,𝑖 − 𝑎1 int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i b[i] = arr[0][i] - a[0];// 𝑏𝑖 = 𝑐1,𝑖 − 𝑎1 b[i] = arr[0][i] - a[0] b[i] b i arr[0][i] - a[0] arr[0][i] arr[0] arr 0 i a[0] a 0 for (int i = 0; i < 3; i++)
        a[i] = arr[i][0] - b[0]; int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i a[i] = arr[i][0] - b[0]; a[i] = arr[i][0] - b[0] a[i] a i arr[i][0] - b[0] arr[i][0] arr[i] arr i 0 b[0] b 0 boolean isGood = true; isGood true for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          if (arr[i][j] != a[i] + b[j]) {
            isGood = false;
          }
        }
      } int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
        for (int j = 0; j < 3; j++) {
          if (arr[i][j] != a[i] + b[j]) {
            isGood = false;
          }
        }
      } {
        for (int j = 0; j < 3; j++) {
          if (arr[i][j] != a[i] + b[j]) {
            isGood = false;
          }
        }
      } for (int j = 0; j < 3; j++) {
          if (arr[i][j] != a[i] + b[j]) {
            isGood = false;
          }
        } int j = 0; int j = 0; j 0 j < 3 j 3 j++ j++ j {
          if (arr[i][j] != a[i] + b[j]) {
            isGood = false;
          }
        } {
          if (arr[i][j] != a[i] + b[j]) {
            isGood = false;
          }
        } if (arr[i][j] != a[i] + b[j]) {
            isGood = false;
          } arr[i][j] != a[i] + b[j] arr[i][j] arr[i] arr i j a[i] + b[j] a[i] a i b[j] b j {
            isGood = false;
          } isGood = false isGood false System.out.println(isGood ? "Yes" : "No") System.out.println System.out System System.out isGood ? "Yes" : "No" isGood "Yes" "No" String[] args args public class Main {
  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      int[][] arr = new int[3][3];
      int[] a = new int[3];//𝑎1, 𝑎2, 𝑎3,
      int[] b = new int[3];//𝑏1, 𝑏2, 𝑏3
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          arr[i][j] = sc.nextInt();
        }
      }

      // 1つ分かれば（ex. 𝑎1=xと仮定すると）他のa,bもxの式で表せられる
      // それで、a1=x+?=0となるxがあるとすると、a1=と仮定して他のa,bもxの式で表せられる・・・はず
      a[0] = 0;
      for (int i = 0; i < 3; i++)
        b[i] = arr[0][i] - a[0];// 𝑏𝑖 = 𝑐1,𝑖 − 𝑎1
      for (int i = 0; i < 3; i++)
        a[i] = arr[i][0] - b[0];

      boolean isGood = true;
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          if (arr[i][j] != a[i] + b[j]) {
            isGood = false;
          }
        }
      }
      System.out.println(isGood ? "Yes" : "No");
    }

  }
} public class Main {
  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      int[][] arr = new int[3][3];
      int[] a = new int[3];//𝑎1, 𝑎2, 𝑎3,
      int[] b = new int[3];//𝑏1, 𝑏2, 𝑏3
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          arr[i][j] = sc.nextInt();
        }
      }

      // 1つ分かれば（ex. 𝑎1=xと仮定すると）他のa,bもxの式で表せられる
      // それで、a1=x+?=0となるxがあるとすると、a1=と仮定して他のa,bもxの式で表せられる・・・はず
      a[0] = 0;
      for (int i = 0; i < 3; i++)
        b[i] = arr[0][i] - a[0];// 𝑏𝑖 = 𝑐1,𝑖 − 𝑎1
      for (int i = 0; i < 3; i++)
        a[i] = arr[i][0] - b[0];

      boolean isGood = true;
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          if (arr[i][j] != a[i] + b[j]) {
            isGood = false;
          }
        }
      }
      System.out.println(isGood ? "Yes" : "No");
    }

  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      int[][] arr = new int[3][3];
      int[] a = new int[3];//𝑎1, 𝑎2, 𝑎3,
      int[] b = new int[3];//𝑏1, 𝑏2, 𝑏3
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          arr[i][j] = sc.nextInt();
        }
      }

      // 1つ分かれば（ex. 𝑎1=xと仮定すると）他のa,bもxの式で表せられる
      // それで、a1=x+?=0となるxがあるとすると、a1=と仮定して他のa,bもxの式で表せられる・・・はず
      a[0] = 0;
      for (int i = 0; i < 3; i++)
        b[i] = arr[0][i] - a[0];// 𝑏𝑖 = 𝑐1,𝑖 − 𝑎1
      for (int i = 0; i < 3; i++)
        a[i] = arr[i][0] - b[0];

      boolean isGood = true;
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          if (arr[i][j] != a[i] + b[j]) {
            isGood = false;
          }
        }
      }
      System.out.println(isGood ? "Yes" : "No");
    }

  }
}
