#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
template <class P, class Q>
void smin(P &a, Q b) {
  if (b < a) a = b;
}
template <class P, class Q>
void smax(P &a, Q b) {
  if (b > a) a = b;
}
int arr[3][3];
bool ok() {
  set<int> S;
  S.insert(arr[0][0] + arr[0][1] + arr[0][2]);
  S.insert(arr[1][0] + arr[1][1] + arr[1][2]);
  S.insert(arr[2][0] + arr[2][1] + arr[2][2]);
  S.insert(arr[0][0] + arr[1][0] + arr[2][0]);
  S.insert(arr[0][1] + arr[1][1] + arr[2][1]);
  S.insert(arr[0][2] + arr[1][2] + arr[2][2]);
  S.insert(arr[0][0] + arr[1][1] + arr[2][2]);
  S.insert(arr[0][2] + arr[1][1] + arr[2][0]);
  return ((int)(S).size()) == 1;
}
void _print() {
  for (int i = (0); i < int(3); ++i) {
    for (int j = (0); j < int(3); ++j) cout << arr[i][j] << ' ';
    cout << endl;
  }
  exit(0);
}
int main() {
  ios_base::sync_with_stdio(false);
  for (int i = (0); i < int(3); ++i)
    for (int j = (0); j < int(3); ++j) cin >> arr[i][j];
  for (int i = (1); i < int(1e5 + 1); ++i) {
    arr[0][0] = i;
    int sum = arr[0][0] + arr[0][1] + arr[0][2];
    arr[1][1] = sum - (arr[1][0] + arr[1][2]);
    arr[2][2] = sum - (arr[2][0] + arr[2][1]);
    if (ok()) {
      _print();
    }
  }
  return 0;
}
