#include <bits/stdc++.h>
using namespace std;
int main(){
	int H, W, K; 
	char S[310][310] = {}; 
	cin >> H >> W >> K; 
	int cnt[310] = {}; 
	vector<int> B[310] = {}; 
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			cin >> S[i][j]; 
			if(S[i][j] == '#') B[i].push_back(j);
		}
	}
	int now = 1; 
	int A[310][310] = {}; 
	for(int i = 0; i < H; i++){
		if(B[i].size() == 0) continue; 
		for(int j = 0; j < B[i].size(); j++){
			A[i][B[i].at(j)] = now; 
			now ++; 
		}
		for(int j = 1; j < W; j++){
			if(A[i][j] == 0) A[i][j] = A[i][j-1]; 
		}
		for(int j = W-2; j >= 0; j--){
			if(A[i][j] == 0) A[i][j] = A[i][j+1]; 
		}
	}
	for(int j = 0; j < W; j++){
		for(int i = 1; i < H; i++){
			if(A[i][j] == 0) A[i][j] = A[i-1][j]; 
		}
	}
	for(int j = 0; j < W; j++){
		for(int i = H-2; i >= 0; i--){
			if(A[i][j] == 0) A[i][j] = A[i+1][j]; 
		}
	}
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			cout << A[i][j] << " "; 
		}
		cout << endl; 
	}
}