#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[9];
  for (int i = 0; i < 9; ++i) scanf("%d", a + i);
  a[0] = (a[2] + a[5] + a[1] + a[7] - a[3] - a[6]) / 2;
  a[4] = a[2] + a[5] - a[0];
  a[8] = a[0] + a[3] + a[6] - a[5] - a[2];
  for (int i = 0; i < 9; ++i) printf("%d%c", a[i], i % 3 == 2 ? '\n' : ' ');
  return 0;
}
