#include <algorithm>
#include <vector>
#include <string>

#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;

int A[ 3 ][ 3 ];
int B[ 3 ][ 3 ];
int C[ 3 ][ 3 ];

void provjeri()
{
    for( int i = 0; i < 3; ++i )
        for( int j = 0; j < 3; ++j ) {
            int maks = -999;

            for( int k = 0; k < 3; ++k )
                maks = max( maks, A[i][k] + B[k][j] );

            if( C[i][j] != maks ) return;
        }

    for( int i = 0; i < 3; ++i )
        for( int j = 0; j < 3; ++j )
            printf( "%d%c", B[i][j], j < 2 ? ' ' : '\n' );

    exit( 0 );
}

void solve( int a, int b )
{
    if( b == 3 ) ++a, b = 0;
    if( a == 3 ) { provjeri(); return; }

    for( int i = 0; i < 3; ++i ) {
        int tmp = B[i][b];
        B[i][b] = C[a][b] - A[a][i];
        solve( a, b + 1 );
        B[i][b] = tmp;
    }
}

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

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

    for( int i = 0; i < 3; ++i )
        for( int j = 0; j < 3; ++j )
            B[i][j] = -999;

    solve( 0, 0 );
    puts( "nemoguce" );
    return 0;
}

