#include <bits/stdc++.h>

#define ff first
#define ss second
#define mp make_pair

using namespace std;

typedef long long ll;

char mat[305][305];
int ans[305][305];

int main() {
	int n,m,k;
	scanf("%d%d%d", &n, &m, &k);

	for(int i = 0; i < n; i++){
		scanf(" %s", mat[i]);
	}

	int cur = 0;
	for(int j = 0; j < m; j++) {
		bool found = false;
		for(int i = 0; i < n; i++) {
			if(mat[i][j] == '#') {
				found = true;
				cur++;
				break;
			}
		}

		if(!found) continue;
		bool first = true;
		for(int i = 0; i < n; i++) {
			if(mat[i][j] == '.') ans[i][j] = cur;
			else {
				if(first) ans[i][j] = cur;
				else ans[i][j] = ++cur;
				first = false;
			}
		}
	}

	for(int j = 1; j < m; j++) {
		for(int i = 0; i < n; i++)
			if(ans[i][j] == 0) ans[i][j] = ans[i][j-1]; 
	}

	for(int j = m-2; j >= 0; j--) {
		for(int i = 0; i < n; i++)
			if(ans[i][j] == 0) ans[i][j] = ans[i][j+1]; 
	}

	for(int i = 0; i < n; i++) {
		for(int j = 0; j < m; j++)
			printf("%d%c",ans[i][j], " \n"[j==m-1]);
	}

    return 0;
}