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