#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;
  cout << c + ((f - d) / 2) << " " << b << " " << c << endl;
  cout << d << " " << (d + f) / 2 << " " << f << endl;
  cout << g << " " << h << " " << g + ((d - f) / 2);
}
