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