#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int mod = 1e9 + 7;
void solve() {
  long long n, m, i, j, k, l, r, p, x, y, z, a, b, c;
  int mat[3][3];
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      cin >> mat[i][j];
    }
  }
  int row1 = mat[0][1] + mat[0][2];
  int row2 = mat[1][0] + mat[1][2];
  int row3 = mat[2][0] + mat[2][1];
  for (int i = 1; i <= 100000; i++) {
    mat[0][0] = i;
    if (i + row1 > row2 && i + row1 > row3) {
      int need = 2 * (i + row1) - row2 - row3;
      if (need == row1) {
        mat[1][1] = i + row1 - row2;
        mat[2][2] = i + row1 - row3;
        break;
      }
    }
  }
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      cout << mat[i][j] << " ";
    }
    cout << "\n";
  }
}
int main() {
  int t;
  solve();
}
