#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, z, a2, a3, b1, b3, c1, c2;
  cin >> x >> a2 >> a3;
  cin >> b1 >> y >> b3;
  cin >> c1 >> c2 >> z;
  x = ((b1 + b3) - (a2 + a3) + (c1 + c2)) / 2;
  y = (c1 + c2) - x;
  z = x + (a2 + a3) - (c1 + c2);
  cout << x << " " << a2 << " " << a3 << endl;
  cout << b1 << " " << y << " " << b3 << endl;
  cout << c1 << " " << c2 << " " << z << endl;
}
