#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  int r1, r2, r3;
  vector<vector<int> > arr;
  vector<int> rows;
  rows.resize(3);
  arr.resize(3);
  for (int i = 0; i < 3; i++) {
    arr[i].resize(3);
  }
  for (int i = 0; i < 3; i++) {
    int t1, t2, t3;
    cin >> t1 >> t2 >> t3;
    rows[i] = t1 + t2 + t3;
    arr[i][0] = t1;
    arr[i][1] = t2;
    arr[i][2] = t3;
  }
  int sum = (rows[0] + rows[1] + rows[2]) / 2;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      if (arr[i][j] == 0) {
        arr[i][j] = sum - rows[i];
      }
      cout << arr[i][j] << " ";
    }
    cout << endl;
  }
}
