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