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