#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[3][3], b[3][3];
  for (int i = 0; i < 3; ++i)
    for (int j = 0; j < 3; ++j) cin >> a[i][j];
  for (int i = 1; i <= 100000; ++i) {
    for (int i = 0; i < 3; ++i)
      for (int j = 0; j < 3; ++j) b[i][j] = a[i][j];
    b[0][0] = i;
    int sm = b[0][0] + b[0][1] + b[0][2];
    b[1][1] = sm - b[1][0] - b[1][2];
    b[2][2] = sm - b[2][0] - b[2][1];
    if (b[0][1] + b[1][1] + b[2][1] != sm) continue;
    if (b[0][2] + b[1][2] + b[2][2] != sm) continue;
    if (b[0][0] + b[1][0] + b[2][0] != sm) continue;
    if (b[0][0] + b[1][1] + b[2][2] != sm) continue;
    if (b[0][2] + b[1][1] + b[2][0] != sm) continue;
    for (int i = 0; i < 3; ++i) {
      for (int j = 0; j < 3; ++j) cout << b[i][j] << " ";
      cout << endl;
    }
  }
}
