#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int x1, r12, r13, r21, x2, r23, r31, r32, x3, s, d, r;
  cin >> x1 >> r12 >> r13 >> r21 >> x2 >> r23 >> r31 >> r32 >> x3;
  s = r21 + r23;
  r = r12 + r13;
  d = s - r;
  x2 = (r31 + r32 - d) / 2;
  x3 = (r12 + r13) - x2;
  x1 = (r21 + r23) - x3;
  cout << x1 << " " << r12 << " " << r13 << endl;
  cout << r21 << " " << x2 << " " << r23 << endl;
  cout << r31 << " " << r32 << " " << x3 << endl;
}
