#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e, f, g, h, i;
  cin >> a >> b >> c >> d >> e >> f >> g >> h >> i;
  int sum1 = 0, sum2 = 0, sum3 = 0, sum = 0;
  sum1 = b + c;
  sum2 = d + f;
  sum3 = g + h;
  sum = (sum1 + sum2 + sum3) / 2;
  a = sum - sum1;
  e = sum - sum2;
  i = sum - sum3;
  cout << a << " " << b << " " << c << "\n"
       << d << " " << e << " " << f << "\n"
       << g << " " << h << " " << i;
  return 0;
}
