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