#include <bits/stdc++.h>
using namespace std;
bool is[1000001 + 1];
long long int g1(long long int x, long long int y) {
  long long int res = 1;
  x = x;
  while (y > 0) {
    if (y & 1) res = (res * x);
    y = y >> 1;
    x = (x * x);
  }
  return res;
}
long long int GCD(long long int A, long long int B) {
  if (B == 0) {
    return A;
  } else {
    return GCD(B, A % B);
  }
}
long long int isMultipleOf3(long long int n) {
  long long int odd_count = 0;
  long long int even_count = 0;
  if (n < 0) n = -n;
  if (n == 0) return 1;
  if (n == 1) return 0;
  while (n) {
    if (n & 1) odd_count++;
    n = n >> 1;
    if (n & 1) even_count++;
    n = n >> 1;
  }
  return isMultipleOf3(abs(odd_count - even_count));
}
vector<char> is_prime(1000001, true);
void seive(long long int n) {
  is_prime[0] = is_prime[1] = false;
  for (long long int i = 2; i * i <= n; i++) {
    if (is_prime[i]) {
      for (long long int j = i * i; j <= n; j += i) is_prime[j] = false;
    }
  }
}
int sod(int num) {
  int sum = 0;
  while (num != 0) {
    sum = sum + num % 10;
    num = num / 10;
  }
  return sum;
}
bool sortbysec(const pair<long long int, long long int> &a,
               const pair<long long int, long long int> &b) {
  return (a.second < b.second);
}
int main() {
  long long int q, n, x, z, y, m = 0, start1 = 0, d, end1 = 0, t, b = 0, f = 0,
                               c = 0, c1 = 0, c3 = 0, c2 = 0;
  long long int k, nod, sum = 0;
  long long int ans = INT_MIN;
  string s, str, s1, s2;
  n = 3;
  long long int a[n][n];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  x = (a[0][1] + a[2][1] - a[1][0] - a[2][0] + a[2][0] + a[2][1]) / 2;
  y = (a[2][0] + a[2][1]) - x;
  z = a[0][1] + a[2][1] - x;
  a[0][0] = x;
  a[1][1] = y;
  a[2][2] = z;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cout << a[i][j] << " ";
    }
    cout << endl;
  }
}
