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

int main() {
	long long H, W, K, NOW = 1;
	static long long ANS[300][300] = {};
	cin >> H >> W >> K;
	string S[300];
	for (int i = 0; i < H; i++) cin >> S[i];
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (S[i][j] == '#') {
				for (int k = i; k >= 0; k--) {
					if (ANS[k][j] != 0) break;
					ANS[k][j] = NOW;
				}
				NOW++;
			}
		}
	}
	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 j = 1; j < W; j++) {
		if (ANS[0][j] == 0) {
			for (int i = 0; i < H; i++) {
				ANS[i][j] = ANS[i][j - 1];
			}
		}
	}
	for (int j = W - 1; j >= 0; j--) {
		if (ANS[0][j] == 0) {
			for (int i = 0; i < H; i++) {
				ANS[i][j] = ANS[i][j + 1];
			}
		}
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (j == W - 1) cout << ANS[i][j] << endl;
			else cout << ANS[i][j] << " ";
		}
	}
}