#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5, mod = 1e9 + 7, mod1 = 998242353, mod2 = 1e9 + 9,
                inf = 1e9 + 7;
const long long infll = 1e18 + 7;
long long a[10][10];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n = 3, m = 3;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  long long x = a[3][1] + a[3][2], y = a[1][2] + a[1][3], z = a[1][2] + a[3][2],
            t = (x + y + z) / 2;
  a[1][1] = t - y;
  a[2][2] = t - z;
  a[3][3] = t - x;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      cout << a[i][j] << ' ';
    }
    cout << '\n';
  }
}
