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