#include <bits/stdc++.h>
using namespace std;
int main() {
  int grid[3][3];
  int s = 0;
  int row[3] = {0};
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> grid[i][j];
      s += grid[i][j];
      row[i] += grid[i][j];
    }
  }
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      if (grid[i][j])
        cout << grid[i][j] << " ";
      else {
        cout << (s - 2 * row[i]) / 2 << " ";
      }
    }
    cout << endl;
  }
}
