#include <algorithm>
#include <cstdio>

using namespace std;

const int oo = 1000000000;

int main( void ) {
    int a[3][3];
    for( int i = 0; i < 3; ++i )
        for( int j = 0; j < 3; ++j )
            scanf( "%d", &a[i][j] );

    int c[3][3];
    for( int i = 0; i < 3; ++i )
        for( int j = 0; j < 3; ++j )
            scanf( "%d", &c[i][j] );

    int b[3][3] = { {oo,oo,oo}, {oo,oo,oo}, {oo,oo,oo} };
    for( int i = 0; i < 3; ++i )
        for( int j = 0; j < 3; ++j )
            for( int k = 0; k < 3; ++k )
                b[k][j] = min( b[k][j], c[i][j] - a[i][k] );

    int ok = 1;
    for( int i = 0; i < 3; ++i )
        for( int j = 0; j < 3; ++j ) {
            int mx = -oo;
            for( int k = 0; k < 3; ++k )
                mx = max( mx, a[i][k] + b[k][j] );
            if( mx != c[i][j] ) ok = 0;
        }

    if( !ok )
        printf( "nemoguce\n" );
    else
        for( int i = 0; i < 3; ++i )
            for( int j = 0; j < 3; ++j )
                printf( "%d%c", b[i][j], j<2 ? ' ' : '\n' );

    return 0;
}
