#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
int CASE = 1;
const int mxn = 1e3 + 1;
const long long INF = 1e18;
void solve() {
  vector<vector<int>> v(3, vector<int>(3));
  for (long long i = 0; i < 3; i++)
    for (long long j = 0; j < 3; j++) cin >> v[i][j];
  for (long long i = 1; i <= 100000; i++) {
    unordered_map<int, int> mp;
    int y = i + v[0][1] + v[0][2] - v[1][0] - v[1][2];
    int z = i + v[0][1] + v[0][2] - v[2][0] - v[2][1];
    mp[i + v[0][1] + v[0][2]]++;
    mp[y + v[1][0] + v[1][2]]++;
    mp[z + v[2][0] + v[2][1]]++;
    mp[i + y + z]++;
    mp[v[0][2] + v[2][0] + y]++;
    mp[i + v[1][0] + v[2][0]]++;
    mp[v[0][1] + y + v[2][1]]++;
    mp[v[0][2] + v[1][2] + z]++;
    if (mp.size() == 1 && min(min((int)i, y), z) >= 1 &&
        max(max((int)i, y), z) <= 1e5) {
      v[0][0] = i, v[1][1] = y, v[2][2] = z;
      for (long long j = 0; j < 3; j++) {
        for (long long k = 0; k < 3; k++) cout << v[j][k] << ' ';
        cout << endl;
      }
      return;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
