#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int a[3][3], sum[3] = {0, 0, 0};
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++) {
      cin >> a[i][j];
      sum[i] += a[i][j];
    }
  int temp = sum[2] - sum[1];
  a[1][1] = (temp + sum[0]) / 2;
  a[0][0] = sum[2] - a[1][1];
  a[2][2] = sum[0] - a[1][1];
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) cout << a[i][j] << " ";
    cout << endl;
  }
  return 0;
}
