#include <bits/stdc++.h>
using namespace std;
bool mycompare(pair<int, int> p1, pair<int, int> p2) {
  return p1.first < p2.first;
}
using namespace std;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  ;
  int a[10], sum = 0;
  for (int i = 1; i <= 9; i++) {
    cin >> a[i];
    sum += a[i];
  }
  int k = sum / 2;
  a[1] = k - (a[4] + a[7]);
  a[5] = k - (a[2] + a[8]);
  a[9] = k - (a[3] + a[6]);
  for (int i = 1; i <= 9; i++) {
    cout << a[i] << " ";
    if (i % 3 == 0) cout << endl;
  }
}
