#include <bits/stdc++.h>
using namespace std;
int f[3][3];
bool isOK() {
  if (f[1][1] <= 0 || f[2][2] <= 0) return false;
  int s = f[0][0] + f[0][1] + f[0][2];
  if (f[0][0] + f[1][1] + f[2][2] != s) return false;
  if (f[0][2] + f[1][1] + f[2][0] != s) return false;
  if (f[0][0] + f[1][0] + f[2][0] != s) return false;
  if (f[0][1] + f[1][1] + f[2][1] != s) return false;
  if (f[0][2] + f[1][2] + f[2][2] != s) return false;
  return true;
}
int main() {
  for (int i = 0; i < 3; ++i)
    for (int j = 0; j < 3; ++j) scanf("%d", &f[i][j]);
  for (int a = 1; a <= 100000; ++a) {
    f[0][0] = a;
    int s = a + f[0][1] + f[0][2];
    f[1][1] = s - f[1][0] - f[1][2];
    f[2][2] = s - f[2][0] - f[2][1];
    if (isOK()) break;
  }
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) printf("%d ", f[i][j]);
    printf("\n");
  }
  return 0;
}
