#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int a[10][10];
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> a[i][j];
    }
  }
  int x1 = a[0][1] + a[0][2];
  int x2 = a[1][0] + a[1][2];
  int x3 = a[2][0] + a[2][1];
  int y = (x1 + x2 + x3) / 2;
  a[0][0] = y - x1;
  a[1][1] = y - x2;
  a[2][2] = y - x3;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cout << a[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
