#include <bits/stdc++.h>
using namespace std;
int main() {
  int ara[3][3];
  int i, j;
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      cin >> ara[i][j];
    }
  }
  int ara2[3];
  int a, b, c, x, y, z;
  x = ara[0][1] + ara[0][2];
  y = ara[1][0] + ara[1][2];
  z = ara[2][0] + ara[2][1];
  ara2[0] = x, ara2[1] = y, ara2[2] = z;
  if (x > y && x > z) {
    if (y > z) {
      a = x, b = y, c = z;
      for (int I = 1; I <= 100000; I++) {
        x = I, y = I + (a - b), z = I + (a - c);
        if (x + y + z == x + ara[0][1] + ara[0][2]) break;
      }
    } else {
      a = x, b = y, c = z;
      for (int I = 1; I <= 100000; I++) {
        x = I, z = I + (a - c), y = I + (a - b);
        if (x + y + z == x + ara[0][1] + ara[0][2]) break;
      }
    }
  } else if (y > x && y > z) {
    if (x > z) {
      a = x, b = y, c = z;
      for (int I = 1; I <= 100000; I++) {
        y = I, x = I + (b - a), z = I + (b - c);
        if (x + y + z == x + ara[0][1] + ara[0][2]) break;
      }
    } else {
      a = x, b = y, c = z;
      for (int I = 1; I <= 100000; I++) {
        y = I, z = I + (b - c), x = I + (b - a);
        if (x + y + z == x + ara[0][1] + ara[0][2]) break;
      }
    }
  } else {
    if (y > x) {
      a = x, b = y, c = z;
      for (int I = 1; I <= 100000; I++) {
        z = I, y = I + (c - b), x = I + (c - a);
        if (x + y + z == x + ara[0][1] + ara[0][2]) break;
      }
    } else {
      a = x, b = y, c = z;
      for (int I = 1; I <= 100000; I++) {
        z = I, x = I + (c - a), y = I + (c - b);
        if (x + y + z == x + ara[0][1] + ara[0][2]) break;
      }
    }
  }
  ara[0][0] = x, ara[1][1] = y, ara[2][2] = z;
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      cout << ara[i][j] << " ";
    }
    cout << " " << endl;
  }
}
