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