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