#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int map[5][5], a = 1, sum;
  for (int i = 1; i <= 3; i++)
    for (int j = 1; j <= 3; j++) cin >> map[i][j];
  while (1) {
    map[1][1] = a;
    sum = map[1][1] + map[1][2] + map[1][3];
    map[2][2] = sum - (map[2][1] + map[2][3]);
    if (map[2][2] != sum - (map[1][2] + map[3][2])) {
      a++;
      continue;
    }
    map[3][3] = sum - map[3][1] - map[3][2];
    if (map[3][3] != sum - (map[1][3] + map[2][3])) {
      a++;
      continue;
    }
    if (map[3][3] != sum - map[1][1] - map[2][2]) {
      a++;
      continue;
    }
    break;
  }
  for (int i = 1; i <= 3; i++) {
    for (int j = 1; j <= 3; j++) cout << map[i][j] << " ";
    cout << endl;
  }
}
