#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[3][3];
  int sum[3] = {0};
  int maxi = INT_MIN;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> a[i][j];
      sum[i] += a[i][j];
    }
    maxi = max(maxi, sum[i]);
  }
  int a1, a2, a3;
  for (a1 = maxi; a1 >= 0; a1--) {
    int netsum = sum[0] + a1;
    a2 = netsum - sum[1];
    a3 = netsum - sum[2];
    if (a1 + a2 + a3 == netsum) {
      break;
    }
  }
  a[0][0] = a1;
  a[1][1] = a2;
  a[2][2] = a3;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cout << a[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
