#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, n = 3, s1, s2, s3;
  vector<vector<long long int> > v(n, vector<long long int>(n));
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) cin >> v[i][j];
  }
  s1 = v[0][1] + v[0][2];
  s2 = v[1][0] + v[1][2];
  s3 = v[2][0] + v[2][1];
  for (i = 0; i <= 3 * pow(10, 5); i++) {
    if (s1 + s2 + s3 == 2 * i && i - s1 > 0 && i - s2 > 0 && i - s3 > 0) break;
  }
  v[0][0] = i - s1;
  v[1][1] = i - s2;
  v[2][2] = i - s3;
  for (i = 0; i < n; i++) {
    for (long long int it = 0; it < v[i].size(); it++) cout << v[i][it] << " ";
    cout << endl;
  }
}
