#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5, mod = 1000000007;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long arr[4][4], r1, r2, r3, c1, c2, c3, d1, d2;
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++) cin >> arr[i][j];
  r1 = arr[0][1] + arr[0][2];
  r2 = arr[1][0] + arr[1][2];
  r3 = arr[2][0] + arr[2][1];
  c1 = arr[1][0] + arr[2][0];
  c2 = arr[0][1] + arr[2][1];
  c3 = arr[0][2] + arr[1][2];
  d1 = arr[0][2] + arr[2][0];
  for (int i = 0; i <= N; i++) {
    int j = (r1 + i) - r2;
    if (r1 + i == r2 + j && r2 + j == d1 + j) {
      int k = (r2 + j) - r3;
      if (i + j + k == r2 + j) {
        for (int a = 0; a < 3; a++) {
          for (int b = 0; b < 3; b++) {
            if (a == 0 && b == 0)
              arr[a][b] = i;
            else if (a == 1 && b == 1)
              arr[a][b] = j;
            else if (a == 2 && b == 2)
              arr[a][b] = k;
            cout << arr[a][b] << " ";
          }
          cout << endl;
        }
        return 0;
      }
    }
  }
  return 0;
}
