#include <bits/stdc++.h>
using namespace std;
int a[5][5];
int main() {
  int n, i, j, k, x, y, z;
  for (i = 1; i <= 3; i++) {
    for (j = 1; j <= 3; j++) scanf("%d", &a[i][j]);
  }
  a[1][1] = a[3][1] + (a[3][2] - a[1][2]) / 2.0;
  a[2][2] = a[3][1] + (a[3][2] + a[1][2]) / 2.0 + a[1][3] - a[2][1] - a[2][3];
  a[3][3] = a[1][3] + (a[1][2] - a[3][2]) / 2.0;
  for (i = 1; i <= 3; i++) {
    printf("%d", a[i][1]);
    for (j = 2; j <= 3; j++) printf(" %d", a[i][j]);
    printf("\n");
  }
  return 0;
}
