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