#include using namespace std; # define pb push_back # define mp make_pair # define FORN( a , b , c ) for ( int a = b ; a <= c ; ++ a ) # define FORNBACK( a , b , c ) for ( int a = b ; a >= c ; -- a ) int mat [ 4000 ] [ 4000 ] ; int main() { ios :: sync_with_stdio ( false ) ; //freopen( "input" , "r" , stdin ) ; //freopen( "output" , "w" , stdout ) ; int n , m , x ; cin >> n >> m >> x ; int lin = 1 ; int cur = 1 ; FORN ( i , 1 , n ) { cur = 1 ; FORN ( j , 1 , m ) { int y ; cin >> y ; FORN ( a , lin , lin + x - 1 ){ FORN ( b , cur , cur + x - 1 ) mat [ a ] [ b ] = y ; } cur += x ; } lin += x ; } FORN ( i , 1 , n * x ){ FORN ( j , 1 , m * x ) cout << mat [ i ] [ j ] << ' ' ; cout << '\n' ; } return 0 ; }