#include <bits/stdc++.h>
using namespace std;
int a, b, c, d, e, f, g, h, i;
int main() {
  cin >> a >> b >> c >> d >> e >> f >> g >> h >> i;
  cout << (f + h) / 2 << " " << b << " " << c << endl
       << d << " " << (d + f) / 2 << " " << f << endl
       << g << " " << h << " " << (b + d) / 2;
}
