#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
template <typename T>
void print(vector<T> v) {
  for (T &i : v) cout << i << " ";
  cout << "\n";
}
bool comp(pair<long long int, long long int> &first,
          pair<long long int, long long int> &second) {
  return first > second;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int arr[3][3];
  for (long long int i = 0; i < 3; i++) {
    for (long long int j = 0; j < 3; j++) {
      cin >> arr[i][j];
    }
  }
  for (long long int i = 0; i < 500000; i++) {
    arr[1][1] = i;
    long long int sum = arr[2][0] + arr[1][1] + arr[0][2];
    arr[0][0] = sum - arr[0][1] - arr[0][2];
    arr[2][2] = sum - arr[2][0] - arr[2][1];
    if ((arr[0][0] + arr[1][1] + arr[2][2]) == sum) {
      for (long long int i = 0; i < 3; i++) {
        for (long long int j = 0; j < 3; j++) {
          cout << arr[i][j] << " ";
        }
        cout << "\n";
      }
      break;
    }
  }
  return 0;
}
