#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;
  a = g + (h - b) / 2;
  e = 2 * g + (h - b) / 2 - f;
  i = c - (h - b) / 2;
  cout << a << " " << b << " " << c << endl;
  cout << d << " " << e << " " << f << endl;
  cout << g << " " << h << " " << i << endl;
  return 0;
}
