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