#include <bits/stdc++.h>
using namespace std;
bool prime_reminder[1000000] = {0};
long long gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(int a, int b) { return (a / gcd(a, b)) * b; }
bool is_prime(long long int n) {
  long long int x = sqrt(n);
  bool check = 1;
  for (long long int i = x; i >= 2; i--) {
    if (n % i == 0) {
      check = 0;
      break;
    }
  }
  return check;
}
vector<long long int> prime_generator(long long int untill) {
  vector<long long int> primes;
  for (long long int i = 2; i <= 3200; i++) {
    if (is_prime(i)) {
      primes.push_back(i);
      prime_reminder[i] = 1;
    }
  }
  return primes;
}
long long int char_to_num(char *str) {
  long long int num = 0, n = strlen(str), r;
  for (int i = 0; i < n; i++) {
    if (str[i] > 47 && str[i] < 58) {
      if (i == 0) {
        num = (str[i] - 48);
        if (n > 1 && str[i + 1] > 47 && str[i + 1] < 58) {
          num *= 10;
        }
      } else {
        num += (str[i] - 48);
        if (i != n - 1 && str[i + 1] > 47 && str[i + 1] < 58) {
          num *= 10;
        }
      }
    }
  }
  return num;
}
char *num_to_char(long long int num, char *str) {
  long long int r, i = 0, n = num, j;
  while (1) {
    r = n % 10;
    str[i] = (48 + r);
    n /= 10;
    if (n == 0) {
      break;
    }
    i++;
  }
  str[i + 1] = '\0';
  for (i = 0, j = strlen(str) - 1; i < strlen(str) / 2; i++, j--) {
    swap(str[i], str[j]);
  }
  return str;
}
bool perfect_square(long long int val) {
  double s = sqrt(val);
  long long int i = sqrt(val);
  if (s == i) {
    return 1;
  } else {
    return 0;
  }
}
bool desc(int a, int b) { return a > b; }
bool cond(int a, int b) {}
int main() {
  int a[4][4], i, j;
  for (i = 1; i <= 3; i++) {
    for (j = 1; j <= 3; j++) {
      cin >> a[i][j];
    }
  }
  a[3][3] = (a[2][1] + a[1][2]) / 2;
  a[2][2] = (a[1][3] + a[3][1]) / 2;
  a[1][1] = (a[2][3] + a[3][2]) / 2;
  for (i = 1; i <= 3; i++) {
    for (j = 1; j <= 3; j++) {
      cout << a[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
