#include <bits/stdc++.h>
using namespace std;
int a[5][5];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int s1 = 0, s2 = 0, s3 = 0;
  vector<int> v;
  int mx = -1;
  for (int i = 0; i < 3; i++) {
    s1 = 0;
    for (int j = 0; j < 3; j++) {
      cin >> a[i][j];
      s1 += a[i][j];
      if (s1 > mx) mx = s1;
    }
    v.push_back(s1);
  }
  int sum = a[0][1] + a[2][1];
  a[1][1] = sum / 2;
  sum += a[1][1];
  a[0][0] = sum - a[0][1] - a[0][2];
  a[2][2] = sum - a[2][0] - a[2][1];
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cout << a[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
