#include <bits/stdc++.h>
using namespace std;
int main() {
  int grid[4][4];
  int i, j;
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) cin >> grid[i][j];
  }
  int r1 = grid[0][1] + grid[0][2];
  int r2 = grid[1][0] + grid[1][2];
  int r3 = grid[2][0] + grid[2][1];
  int a, b = 0, c;
  for (i = 1; i <= 100000; i++) {
    b = i;
    int sum = grid[1][0] + b + grid[1][2];
    a = sum - (grid[0][1] + grid[0][2]);
    c = sum - (grid[2][0] + grid[2][1]);
    if (a + grid[1][0] + grid[2][0] == sum &&
        grid[0][1] + b + grid[2][1] == sum &&
        grid[0][2] + grid[1][2] + c == sum && a > 0 && c > 0 &&
        a + b + c == sum && grid[0][2] + b + grid[2][0] == sum)
      break;
  }
  grid[0][0] = a;
  grid[1][1] = b;
  grid[2][2] = c;
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      if (j != 2)
        cout << grid[i][j] << " ";
      else
        cout << grid[i][j];
    }
    cout << endl;
  }
}
