/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

const int N=300;

int r,c;
char maz[N+30][N+30];
int ans[N+30][N+30];
bool xx[N+30];

int main(){
	scanf("%d%d%*d",&r,&c);
	for(int i=1;i<=r;i++)
		scanf("%s",maz[i]+1);
	int lasr=1,cnt=0;
	for(int i=1;i<=r;i++){
		int lef=1;
		bool non=true;
		for(int j=1;j<=c;j++)
			if(maz[i][j]=='#'){
				non=false;
				cnt++;
				// printf("? %d %d %d %d\n",i,j,cnt,lef);
				for(int k=lasr;k<=i;k++){
					ans[k][lef]+=cnt;
					ans[k][j+1]-=cnt;
					xx[k]=false;
				}
				lef=j+1;
			}
		if(!non){
			for(int j=lasr;j<=i;j++)
				ans[j][lef]+=cnt;
			lasr=i+1;
		}
		else xx[i]=true;
	}
	for(int i=1;i<=r;i++){
		for(int j=1;j<=c;j++){
			if(xx[i])
				ans[i][j]=ans[i-1][j];
			else
				ans[i][j]+=ans[i][j-1];
			printf("%d",ans[i][j]);
			if(j==c) putchar('\n');
			else putchar(' ');
		}
	}
	return 0;
}
