/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0

using ll = long long;

const int INF = 1073741823;
const int MINF = -1073741823;
const ll LINF = ll(4661686018427387903);
const ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/
int h, w, k;
void dfs(int nowx, int nowy, vector<vector<int>>& a, int number, int mode) {
	if (nowx > w - 1 || nowy > h - 1|| nowx < 0 || nowy < 0)return;
	int newnumber = 0;
	if (a[nowy][nowx] == 0) {
		a[nowy][nowx] = number;
		newnumber = number;
	}
	else {
		newnumber = a[nowy][nowx];
	}
	if (mode == 0) {
		dfs(nowx + 1, nowy, a, newnumber, 1);
		dfs(nowx - 1, nowy, a, newnumber, 2);
	}
	else if(mode == 1)dfs(nowx + 1, nowy, a, newnumber, 1);
	else if(mode == 2)dfs(nowx - 1, nowy, a, newnumber, 2);
	return;
}

int main() {


	scanf("%d%d%d", &h, &w, &k);
	vector<string> s(h);
	rep(i, h) {
		scans(s[i]);
	}
	vector<vector<int>> a(h, vector<int>(w));
	int ii = k;
	rep(i, h) {
		rep(j, w) {
			if (s[i][j] == '#') {
				a[i][j] = ii;
				--ii;
			}
		}
	}
	rep(i, h) {
		rep(j, w) {
			if (s[i][j] == '#') {
				dfs(j, i, a, a[i][j], 0);
				break;
			}
		}
	}
	bool rev = false;
	rep(i, h) {
		rep(j, w) {
			if (a[i][j] == 0) {
				if (i != 0)a[i][j] = a[i - 1][j];
				else rev = true;
 			}
		}
	}
	if (rev) {
		rev = false;
		repr(i, h - 1) {
			repr(j, w - 1) {
				if (a[i][j] == 0) {
					if (i != h - 1)a[i][j] = a[i + 1][j];
				}
			}
		}
	}
	rep(i, h) {
		rep(j, w) {
			printf("%d\n", a[i][j]);
		}
	}

	Please AC;

}


Measured memory_bytes: 1280