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