#include <bits/stdc++.h>
using namespace std;
int main() {
  int m[3][3], total = 0;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> m[i][j];
      total += m[i][j];
    }
  }
  int r1 = m[0][1] + m[0][2];
  int r2 = m[1][0] + m[1][2];
  int r3 = m[2][0] + m[2][1];
  total /= 2;
  m[0][0] = total - r1;
  m[1][1] = total - r2;
  m[2][2] = total - r3;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cout << m[i][j] << " ";
    }
    cout << "\n";
  }
}
