#include <bits/stdc++.h>
using namespace std;
int a[4][4], kk;
bool ok;
int main() {
  for (int i = 0; i < 3; ++i)
    for (int j = 0; j < 3; ++j) scanf("%d", &a[i][j]);
  kk = max(a[0][1] + a[0][2], max(a[1][0] + a[1][2], a[2][0] + a[2][1])) +
       100000;
  for (int i = a[0][1] + a[0][2] + 1; i <= kk; ++i) {
    a[0][0] = i - a[0][1] - a[0][2];
    a[1][1] = i - a[1][0] - a[1][2];
    a[2][2] = i - a[2][0] - a[2][1];
    ok = true;
    for (int j = 0; j < 3 && ok; ++j) ok &= (a[0][j] + a[1][j] + a[2][j] == i);
    ok &=
        (a[0][0] + a[1][1] + a[2][2] == i && a[0][2] + a[1][1] + a[2][0] == i);
    if (ok) break;
  }
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) printf("%d ", a[i][j]);
    printf("\n");
  }
  return 0;
}
