#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 6, nBits = 2e8 + 5, M = (1 << 16), MAX = 1111,
          OO = 0x3f3f3f3f, MOD = 1e9 + 7, inf = 1 << 30;
const long long INF = (long long)1e18;
long long GCD(long long a, long long b) { return !b ? a : GCD(b, a % b); }
long long LCM(long long x, long long y) { return (x * y / GCD(x, y)); }
long long fact(long long z) { return (z <= 1) ? 1 : z * fact(z - 1); }
int sum[4], x, grid[4][4];
int main() {
  for (int i = 0; i < 3; ++i)
    for (int j = 0; j < 3; ++j) {
      scanf("%d", &x);
      sum[i] += x;
      grid[i][j] = x;
    }
  for (int a = 1; a <= 1e5; ++a) {
    int b = sum[0] - sum[1] + a;
    int c = sum[0] - sum[2] + a;
    if (b && c && b <= 1e5 && c <= 1e5 && b + c == sum[0]) {
      grid[0][0] = a;
      grid[1][1] = b;
      grid[2][2] = c;
      for (int i = 0; i < 3; ++i) {
        for (int j = 0; j < 3; ++j) printf("%d ", grid[i][j]);
        puts("");
      }
      return 0;
    }
  }
  return 0;
}
