#include <bits/stdc++.h>
using namespace std;
int main() {
  int mat[3][3];
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++) cin >> mat[i][j];
  int x, y, z;
  y = (mat[0][1] + mat[0][2] - (mat[1][0] + mat[1][2]) +
       (mat[2][0] + mat[2][1])) /
      2;
  z = mat[0][1] + mat[0][2] - y;
  x = mat[1][0] + mat[1][2] - z;
  mat[0][0] = x;
  mat[1][1] = y;
  mat[2][2] = z;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) cout << mat[i][j] << " ";
    cout << endl;
  }
  return 0;
}
