#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[3][3];
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> a[i][j];
    }
  }
  int s1 = a[0][1] + a[0][2];
  int s2 = a[1][0] + a[1][2];
  int s3 = a[2][0] + a[2][1];
  int s4 = s2 - s1;
  a[1][1] = abs(s4 - s3) / 2;
  a[0][0] = a[1][1] + s4;
  a[2][2] = abs(s1 - a[1][1]);
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cout << a[i][j];
      if (j != 2) cout << " ";
    }
    if (i != 2) cout << "\n";
  }
  return 0;
}
