#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define PI (acos(-1))

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int h,w,k;
	cin>>h>>w>>k;
	vector<vector<char>> g(h,vector<char>(w));
	rep(i,h)rep(j,w) cin>>g[i][j];
	vector<vector<int>> ans(h,vector<int>(w,-1));
	int now=1;
	rep(i,h)rep(j,w){
		if(g[i][j]!='#' || ans[i][j]!=-1) continue;
		ans[i][j]=now;
		int u1=0,u2=0;
		for(int x=i-1;x>=0;x--){//まず上下から埋める
			if(g[x][j]=='#' || ans[x][j]!=-1) break;
			ans[x][j]=now; 
			u1++;
		}
		FOR(x,i+1,h){
			if(g[x][j]=='#' || ans[x][j]!=-1) break;
			ans[x][j]=now; 
			u2++;
		}
		for(int y=j-1;y>=0;y--){
			if(g[i][y]=='#' || ans[i][y]!=-1) break;
			bool flag=true;
			for(int x=i+u2;x>=i-u1;x--){
				if(g[x][y]=='#' || ans[x][y]!=-1){
					flag=false;
					break;
				}
			}
			if(flag){
				for(int x=i+u2;x>=i-u1;x--){
					ans[x][y]=now;
				}
			}else{
				break;
			}
		}
		for(int y=j+1;y<w;y++){
			if(g[i][y]=='#' || ans[i][y]!=-1) break;
			bool flag=true;
			for(int x=i+u2;x>=i-u1;x--){
				if(g[x][y]=='#' || ans[x][y]!=-1){
					flag=false;
					break;
				}
			}
			if(flag){
				for(int x=i+u2;x>=i-u1;x--){
					ans[x][y]=now;
				}
			}else{
				break;
			}
		}
		//cout<<u1<<' '<<u2<<endl;
		//cout<<ans<<endl;
 		now++;
	}
	bool flag=true;
	rep(i,h)rep(j,w){
		if(ans[i][j]==-1){
			flag=false;
			break;
		}
	}
	if(flag) {
		cout<<ans<<endl;
		return 0;
	}
	rep(i,h)rep(j,w) ans[i][j]=-1;
	now=1;
	rep(i,h)rep(j,w){
		if(g[i][j]!='#' || ans[i][j]!=-1) continue;
		ans[i][j]=now;
		int u1=0,u2=0;
		for(int x=j-1;x>=0;x--){//まず横から埋める
			if(g[i][x]=='#' || ans[i][x]!=-1) break;
			ans[i][x]=now; 
			u1++;
		}
		FOR(x,j+1,w){
			if(g[i][x]=='#' || ans[i][x]!=-1) break;
			ans[i][x]=now; 
			u2++;
		}
		for(int y=i-1;y>=0;y--){
			if(g[y][j]=='#' || ans[y][j]!=-1) break;
			bool flag=true;
			for(int x=j+u2;x>=j-u1;x--){
				if(g[y][x]=='#' || ans[y][x]!=-1){
					flag=false;
					break;
				}
			}
			if(flag){
				for(int x=j+u2;x>=j-u1;x--){
					ans[y][x]=now;
				}
			}else{
				break;
			}
		}
		for(int y=i+1;y<h;y++){
			if(g[y][j]=='#' || ans[y][j]!=-1) break;
			bool flag=true;
			for(int x=j+u2;x>=j-u1;x--){
				if(g[y][x]=='#' || ans[y][x]!=-1){
					flag=false;
					break;
				}
			}
			if(flag){
				for(int x=j+u2;x>=j-u1;x--){
					ans[y][x]=now;
				}
			}else{
				break;
			}
		}
		//cout<<u1<<' '<<u2<<endl;
		//cout<<ans<<endl;
 		now++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1280