#include <bits/stdc++.h>
using namespace std;
long long tests;
long long a[10][10], s[10][10], cur;
int main() {
  for (int i = 1; i <= 3; i++)
    for (int j = 1; j <= 3; j++) cin >> a[i][j];
  for (int cnt = a[1][2] + a[1][3] + 1;; cnt++) {
    for (int i = 1; i <= 3; i++)
      for (int j = 1; j <= 3; j++) s[i][j] = a[i][j];
    s[1][1] = cnt - (a[1][2] + a[1][3]);
    s[2][2] = cnt - (a[2][1] + a[2][3]);
    s[3][3] = cnt - (a[3][1] + a[3][2]);
    bool ok = 0;
    for (int i = 1; i <= 3; i++) {
      cur = 0;
      for (int j = 1; j <= 3; j++) cur += s[i][j];
      if (cur != cnt) ok = 1;
    }
    for (int i = 1; i <= 3; i++) {
      cur = 0;
      for (int j = 1; j <= 3; j++) cur += s[j][i];
      if (cur != cnt) ok = 1;
    }
    if (s[1][1] + s[2][2] + s[3][3] != cnt) ok = 1;
    if (s[1][3] + s[2][2] + s[3][1] != cnt) ok = 1;
    if (!ok) {
      for (int i = 1; i <= 3; i++) {
        for (int j = 1; j <= 3; j++) cout << s[i][j] << " ";
        cout << endl;
      }
      return 0;
    }
  }
}
