#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int a[3][3];
  int i, j;
  int sum[3] = {0};
  for (i = 0; i < 3; ++i) {
    for (j = 0; j < 3; ++j) {
      cin >> a[i][j];
      sum[i] += a[i][j];
    }
  }
  int avg = (sum[0] + sum[1] + sum[2]) / 2;
  for (i = 0; i < 3; ++i) {
    a[i][i] = avg - sum[i];
  }
  for (i = 0; i < 3; ++i) {
    for (j = 0; j < 3; ++j) {
      cout << a[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
