#include <bits/stdc++.h>
using namespace std;
int n, a;
int sum1 = 0, sum2 = 0, sum3 = 0, sum4 = 0;
int x, y, z;
map<pair<int, int>, int> mp;
void f() {
  z = (sum3 + sum2 - sum1) / 2;
  x = (z + (sum1 - sum2));
  y = (x + (sum2 - sum4));
}
void maker() {
  sum1 = mp[make_pair(3, 1)] + mp[make_pair(3, 2)];
  sum2 = mp[make_pair(1, 2)] + mp[make_pair(1, 3)];
  sum3 = mp[make_pair(1, 3)] + mp[make_pair(3, 1)];
  sum4 = mp[make_pair(2, 1)] + mp[make_pair(2, 3)];
}
void start() {
  for (int i = 1; i <= 3; i++) {
    for (int j = 1; j <= 3; j++) {
      cin >> a;
      mp[make_pair(j, i)] = a;
    }
  }
  maker();
  f();
  mp[make_pair(1, 1)] = x;
  mp[make_pair(2, 2)] = y;
  mp[make_pair(3, 3)] = z;
  for (int i = 1; i <= 3; i++) {
    for (int j = 1; j <= 3; j++) {
      if (j != 1) cout << " ";
      cout << mp[make_pair(j, i)];
    }
    cout << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  start();
  return 0;
}
