#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
long long a[5][5];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  for (int i = 1; i <= 3; i++) {
    for (int j = 1; j <= 3; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 1; i <= 1e5; i++) {
    a[1][1] = i;
    long long n = a[1][1] + a[1][2] + a[1][3];
    a[2][2] = n - a[2][1] - a[2][3];
    a[3][3] = n - a[3][1] - a[3][2];
    if (a[1][1] + a[2][2] + a[3][3] == n) {
      for (int j = 1; j <= 3; j++) {
        for (int x = 1; x <= 3; x++) {
          cout << a[j][x] << ' ';
        }
        cout << "\n";
      }
      break;
    }
  }
  return 0;
}
