#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const long long llinf = 0x3f3f3f3f3f3f3f3f;
const long long mod = 1000000007;
int mp[5][5];
int main() {
  for (int i = 1; i <= 3; i++) {
    for (int j = 1; j <= 3; j++) {
      scanf("%d", &mp[i][j]);
    }
  }
  int tem1 = mp[2][1] + mp[3][1];
  int tem2 = mp[1][2] + mp[3][2];
  int tem3 = mp[1][3] + mp[2][3];
  mp[3][3] = (tem1 + tem2 - tem3) / 2;
  mp[2][2] = mp[3][3] - tem2 + tem3;
  mp[1][1] = mp[3][3] - tem1 + tem3;
  for (int i = 1; i <= 3; i++) {
    for (int j = 1; j <= 3; j++) {
      printf("%d%c", mp[i][j], (j == 3) ? '\n' : ' ');
    }
  }
}
