#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c;
  int d, e, f;
  int g, h, i, j;
  cin >> a >> b >> c;
  cin >> d >> e >> f;
  cin >> g >> h >> j;
  for (int i = 1;; i++) {
    int det = i + d + f;
    if (det == b + h + i && det == c + g + i) {
      int aa = det - d - g;
      int jj = det - c - f;
      if (aa + jj + i == det) {
        cout << aa << " " << b << " " << c << endl;
        cout << d << " " << i << " " << f << endl;
        cout << g << " " << h << " " << jj << endl;
        break;
      }
    }
  }
}
