#include <bits/stdc++.h>
using namespace std;
int data[4][4];
int main(void) {
  int i, j, k;
  for (i = 1; i <= 3; i++) {
    for (j = 1; j <= 3; j++) {
      scanf("%d", &data[i][j]);
    }
  }
  int a1 = data[1][2] + data[1][3];
  int b1 = data[2][1] + data[2][3];
  int c1 = data[3][1] + data[3][2];
  int mymax1 = 0;
  if (a1 > mymax1) mymax1 = a1;
  if (b1 > mymax1) mymax1 = b1;
  if (c1 > mymax1) mymax1 = c1;
  int a2 = data[2][1] + data[3][1];
  int b2 = data[1][2] + data[3][2];
  int c2 = data[1][3] + data[2][3];
  int mymax2 = 0;
  if (a2 > mymax2) mymax2 = a2;
  if (b2 > mymax2) mymax2 = b2;
  if (c2 > mymax2) mymax2 = c2;
  int mymax3 = data[1][3] + data[3][1];
  int mymax = 0;
  if (mymax1 > mymax) mymax = mymax1;
  if (mymax2 > mymax) mymax = mymax2;
  if (mymax3 > mymax) mymax = mymax3;
  mymax += 1;
  data[1][1] = mymax - a1;
  data[2][2] = mymax - b1;
  data[3][3] = mymax - c1;
  int b = mymax;
  int a = data[1][1] + data[2][2] + data[3][3];
  int x;
  if ((b - a) % 2 == 1) {
    x = (b - a + 3) / 2;
    b += 3;
  } else {
    x = (b - a) / 2;
  }
  mymax += x;
  data[1][1] = mymax - a1;
  data[2][2] = mymax - b1;
  data[3][3] = mymax - c1;
  for (i = 1; i <= 3; i++) {
    cout << data[i][1];
    for (j = 2; j <= 3; j++) {
      printf(" %d", data[i][j]);
    }
    cout << endl;
  }
  return 0;
}
