#include <bits/stdc++.h>
using namespace std;
int main() {
  int diag = 0, sums[3], sq[3][3], i, j, max_sum = 0;
  for (i = 0; i < 3; i++) {
    sums[i] = 0;
    for (j = 0; j < 3; j++) {
      cin >> sq[i][j];
      sums[i] += sq[i][j];
    }
    if (max_sum < sums[i]) max_sum = sums[i];
  }
  max_sum++;
  for (i = 0; i < 3; i++) {
    sq[i][i] = max_sum - sums[i];
    diag += sq[i][i];
  }
  diag = (max_sum - diag) / 2;
  for (i = 0; i < 3; i++) {
    sq[i][i] += diag;
    for (j = 0; j < 3; j++) cout << sq[i][j] << ' ';
    cout << endl;
  }
  return 0;
}
