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