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