#include <iostream>
using namespace std;

int main() {
	int n,m,x,a[201][201];
	cin>>n>>m>>x;
	for(int i=0;i<n;i++){
	for(int j=0;j<m;j++)
		{int b;
		cin>>b;
		int st1=i*x,fi1=(i*x)+x,st2=j*x,fi2=(j*x)+x;
		for(int k=st1;k<=fi1;k++){
			for(int k1=st2;k1<=fi2;k1++)
			a[k][k1]=b;
		}
	}
	}
	for(int i=0;i<n*x;i++)
	{for(int j=0;j<m*x;j++)
	cout<<a[i][j];
	cout<<"\n";
	}
	return 0;
}