#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int x, y, z;
  int a[3][3];
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> a[i][j];
    }
  }
  x = (a[2][0] + a[2][1] + a[1][0] + a[1][2] - a[0][1] - a[0][2]) / 2;
  y = a[2][0] + a[2][1] - x;
  z = a[1][0] + a[1][2] - x;
  a[0][0] = x;
  a[1][1] = y;
  a[2][2] = z;
  for (int i = 0; i < 3; i++) {
    cout << a[i][0] << " " << a[i][1] << " " << a[i][2];
    cout << "\n";
  }
  return 0;
}
