#include <bits/stdc++.h>
using namespace std;
const int NMAX = 1e5 + 5;
long double eps = 1e-9;
int main() {
  int n;
  int a1, a2, c1, c2, b1, b2, x, y, z;
  cin >> x >> a1 >> a2;
  cin >> b1 >> y >> b2;
  cin >> c1 >> c2 >> z;
  x = (2 * c1 + c2 - a1) / 2;
  z = a2 + c1 - x;
  y = x + a1 + a2 - b1 - b2;
  cout << x << " " << a1 << " " << a2 << endl;
  cout << b1 << " " << y << " " << b2 << endl;
  cout << c1 << " " << c2 << " " << z << endl;
  return 0;
}
