#include <bits/stdc++.h>
int const OO = 1e9;
using namespace std;
void fast() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
}
void file() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
int main() {
  fast();
  vector<vector<int>> v(3, vector<int>(3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> v[i][j];
    }
  }
  long long su1, su2, su3, mx;
  su1 = v[0][1] + v[0][2], su2 = v[1][0] + v[1][2], su3 = v[2][0] + v[2][1];
  mx = max({su1, su2, su3});
  while (true) {
    mx++;
    long long d = (mx - su1) + (mx - su2) + (mx - su3);
    if (mx == d) {
      v[0][0] = mx - su1, v[1][1] = mx - su2, v[2][2] = mx - su3;
      break;
    }
  }
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cout << v[i][j] << ' ';
    }
    cout << '\n';
  }
  return 0;
}
