#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[3][3];
  memset(a, 0, sizeof(a));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> a[i][j];
    }
  }
  int r1 = a[0][1] + a[0][2];
  int r2 = a[2][0] + a[2][1];
  for (int i = 10e5; i >= 0; i--) {
    int sum = a[0][1] + i + a[2][1];
    int a00 = sum - r1;
    int a22 = sum - r2;
    int d = i + a00 + a22;
    if (d == r1 + a00 && d == r2 + a22) {
      a[0][0] = a00;
      a[2][2] = a22;
      a[1][1] = i;
      break;
    }
  }
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cout << a[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
