#include<bits/stdc++.h>
using namespace std;
char ch[305][305];
int tot=0,vis[305],ans[305][305];
int main(){
	int H,W,k;
	cin>>H>>W>>k;
	for(int i=1;i<=H;++i)
		for(int j=1;j<=W;++j)
			cin>>ch[i][j],vis[i]|=(ch[i][j]=='#');
	for(int i=1;i<=H;++i)
		if(vis[i]){
			int fl=0;
			for(int j=1;j<=W;++j)
				if(ch[i][j]=='#') ans[i][j]=++tot,fl=1;
				else ans[i][j]=(fl==1?tot:tot+1);
		}
	for(int i=2;i<=H;++i)
		if(vis[i-1] && !vis[i]){
			for(int j=1;j<=W;++j)
				ans[i][j]=ans[i-1][j];
			vis[i]=1;
		}
	for(int i=H-1;i>=1;--i)
		if(vis[i+1] && !vis[i]){
			for(int j=1;j<=W;++j)
				ans[i][j]=ans[i+1][j];
			vis[i]=1;
		}
	for(int i=1;i<=H;++i,puts(""))
		for(int j=1;j<=W;++j,putchar(' '))
			cout<<ans[i][j];
	return 0;
}