#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[3][3];
  int cnt1, cnt2, cnt3;
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++) scanf("%d", &arr[i][j]);
  cnt1 = arr[0][1] + arr[0][2];
  cnt2 = arr[1][0] + arr[1][2];
  cnt3 = arr[2][0] + arr[2][1];
  if (cnt1 >= cnt2 && cnt1 >= cnt3) {
    for (int i = 1; i <= 1e5; i++)
      if (cnt1 + i == cnt2 + (cnt1 - cnt2 + i) &&
          cnt1 + i == cnt3 + (cnt1 - cnt3 + i) &&
          i + (cnt1 - cnt3 + i) + (cnt1 - cnt2 + i) == cnt1 + i) {
        arr[0][0] = i;
        arr[1][1] = (cnt1 - cnt2 + i);
        arr[2][2] = (cnt1 - cnt3 + i);
        break;
      }
  } else if (cnt2 >= cnt1 && cnt2 >= cnt3) {
    for (int i = 1; i <= 1e5; i++)
      if (cnt2 + i == cnt1 + (cnt2 - cnt1 + i) &&
          cnt2 + i == cnt3 + (cnt2 - cnt3 + i) &&
          i + (cnt2 - cnt3 + i) + (cnt2 - cnt1 + i) == cnt2 + i) {
        arr[0][0] = (cnt2 - cnt1 + i);
        arr[1][1] = i;
        arr[2][2] = (cnt2 - cnt3 + i);
        break;
      }
  } else if (cnt3 >= cnt1 && cnt3 >= cnt2) {
    for (int i = 1; i <= 1e5; i++)
      if (cnt3 + i == cnt1 + (cnt3 - cnt1 + i) &&
          cnt3 + i == cnt2 + (cnt3 - cnt2 + i) &&
          i + (cnt3 - cnt2 + i) + (cnt3 - cnt1 + i) == cnt3 + i) {
        arr[0][0] = (cnt3 - cnt1 + i);
        arr[1][1] = (cnt3 - cnt2 + i);
        arr[2][2] = i;
        break;
      }
  }
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) printf("%d ", arr[i][j]);
    puts("");
  }
  return 0;
}
