#include <bits/stdc++.h>
using namespace std;

int main(void){
	int h, w, k, i, j, num = 1, cur = -1, fr = 500;
    cin >> h >> w >> k;
    
    vector<vector<int>> ans(h, vector<int>(w, -1));
    vector<int> cp(h, -2);
    for (i = 0; i < h; i++){
    	string s; bool ok = false, first = true;
        cin >> s;
        for (j = 0; j < w; j++) if (s[j] == '#') {ok = true; break;}
        if (!ok) {cp[i] = cur; continue;}

        cur = i; fr = min(fr, i);
        for (j = 0; j < w; j++){
        	if (s[j] == '#'){
            	if (first) ans[i][j] = num, first = false;
                else ans[i][j] = ++num;
            }else{
            	ans[i][j] = num;
            }
        }
      	++num;
    }
    
    for (i = 0; i < h; i++){
      	int idx = cp[i] == -2 ? i : (cp[i] == -1 ? fr :  cp[i]);
		for (j = 0; j < w; j++) printf("%d ", ans[idx][j]);
      	printf("\n");
    }
    
	return 0;
}