#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 998244353
#define LINF 100000000000000007LL
#define ll long long
using namespace std;
int ans[310][310];
signed main(){
	int h,w,k;
	cin>>h>>w>>k;
	vector<string> fie;
	for(int i=0;i<h;i++){
		string st;
		cin>>st;
		fie.pb(st);
	}
	int nex = 1;
	for(int i=0;i<h;i++){
		int cur = 0;
		for(int j=0;j<w;j++){
			if( fie[i][j] == '#' ){
				cur = nex;
				nex++;
			}
			ans[i][j] = cur;
		}
		for(int j=w-1;j>=0;j--){
			if( ans[i][j] == 0 ) ans[i][j] = ans[i][j+1];
		}
	}
	for(int i=1;i<h;i++){
		for(int j=0;j<w;j++){
			if( ans[i][j] == 0 ) ans[i][j] = ans[i-1][j];
		}
	}
	for(int i=h-1;i>=0;i--){
		for(int j=0;j<w;j++){
			if( ans[i][j] == 0 ) ans[i][j] = ans[i+1][j];
		}
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cout<<ans[i][j]<<" ";
		}
		cout<<endl;
	}
	return 0;
}