#include <bits/stdc++.h>
using namespace std;
void solve();
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
  cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
  return 0;
}
void solve() {
  int a[9];
  for (int i = 0; i < 9; i++) cin >> a[i];
  a[8] = a[2] - (a[7] - a[1]) / 2;
  a[0] = a[6] + (a[7] - a[1]) / 2;
  a[4] = (a[7] + a[1]) / 2;
  for (int i = 0; i < 9; i++) {
    cout << a[i] << " ";
    if (i % 3 == 2) cout << "\n";
  }
}
