#include <bits/stdc++.h>
using namespace std;
struct item {
  bool l;
  int c;
};
int main(void) {
  ios_base::sync_with_stdio(false);
  int first[3][3];
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) cin >> first[i][j];
  }
  for (int i = 1; i <= 100000; i++) {
    first[0][0] = i;
    long sum = first[0][0] + first[0][1] + first[0][2];
    first[1][1] = (sum - first[1][0] - first[1][2]);
    first[2][2] = (sum - first[2][0] - first[2][1]);
    if ((first[0][0] + first[1][1] + first[2][2]) != sum ||
        (first[0][0] + first[0][1] + first[0][2]) != sum ||
        (first[1][0] + first[1][1] + first[1][2]) != sum ||
        (first[2][0] + first[2][1] + first[2][2]) != sum)
      continue;
    if (1 <= first[1][1] && first[1][1] <= 100000 && 1 <= first[2][2] &&
        first[2][2] <= 100000) {
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) cout << first[i][j] << " ";
        cout << "\n";
      }
      return 0;
    }
  }
  return 0;
}
