#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int arr[3][3];
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++) cin >> arr[i][j];
  int sum1 = arr[0][1] + arr[0][2];
  int sum2 = arr[1][0] + arr[1][2];
  int sum3 = arr[2][0] + arr[2][1];
  arr[0][0] = (sum2 + sum3 - sum1) / 2;
  arr[1][1] = (-sum2 + sum3 + sum1) / 2;
  arr[2][2] = (sum2 - sum3 + sum1) / 2;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cout << arr[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
