#include <bits/stdc++.h>
using namespace std;
const int maxN = 3 * 100000;
int main() {
  int squ[3][3];
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) cin >> squ[i][j];
  }
  for (int sum = 3; sum <= maxN; sum++) {
    squ[0][0] = squ[1][1] = squ[2][2] = 0;
    squ[0][0] = sum - squ[0][1] - squ[0][2];
    squ[1][1] = sum - squ[1][0] - squ[1][2];
    squ[2][2] = sum - squ[2][0] - squ[2][1];
    if (squ[0][0] <= 0 || squ[1][1] <= 0 || squ[2][2] <= 0) continue;
    if (sum == squ[0][0] + squ[1][1] + squ[2][2]) {
      break;
    }
  }
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) {
      cout << squ[i][j] << ' ';
    }
    cout << '\n';
  }
  return 0;
}
