// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

// #include <bits/extc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp> // tree
// #include <ext/pb_ds/hash_policy.hpp> // hash
// #include <ext/pb_ds/trie_policy.hpp> // trie
// #include <ext/pb_ds/priority_queue.hpp> // priority_queue
// using namespace __gnu_pbds;

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

#define IOS() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define X first
#define Y second
#define ALL(x) x.begin(), x.end()
#define RALL(x) x.rbegin(), x.rend()
#define Push push_back

using lli = long long;
using pii = pair<int, int>;
using pll = pair<lli, lli>;
using Double = long double;
template<typename T>
using Vector = vector<vector<T>>;
template<typename T>
using Prior = priority_queue<T>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;

const lli mod = 1E9 + 7;
const Double PI = 3.1415926535846;
const Double eps = 1e-8;

lli fastPow(lli base, lli exp, lli module = mod) {
	lli ans = 1;
	base %= module;
	while (exp) {
		if (exp & 1) ans = ans * base % module;
		base = base * base % module;
		exp >>= 1;
	}
	return ans;
}

bool millerRabin(lli n, lli a) {
	/*
	 * n < 4,759,123,141		3 : {2, 7, 61}
	 * n < 1,122,004,669,633	4 : {2, 13, 23, 1662803}
	 * n < 3,474,749,660,383	6 : {p in [2, 13]}
	 * n < 2^64					7 : 
	 * {2, 325, 9375, 28178, 450775, 9780504, 1795265022}
	 *
	 * else, random everytime gives a 75% of correction
	 */
	
	if (n < 2) return 0;
	if ((a = a%n) == 0) return 1;
	if (n & 1 ^ 1) return n == 2;
	
	lli lowb = (n - 1) & -(n - 1);
	lli tmp = (n - 1) / lowb; // lowbit of (n-1)
	lli t = __lg(lowb);
	lli x = 1;
	
	for (; tmp; tmp /= 2, a = a*a%n) {
		if (tmp & 1) x = x * a % n;
	}
	
	if (x == 1 or x == n - 1) return 1;
	
	while (--t) {
		if ((x = x*x%n) == n - 1) return 1;
	}
	
	return 0;
}

bool MR_PrimeFilter(lli n) {
	vector<lli> v[4];
	v[0] = {2, 7, 61};
	v[1] = {2, 13, 23, 1662803};
	v[2] = {2, 3, 5, 7, 11, 13};
	v[3] = {2, 325, 9375, 28178, 450775, 9780504, 1795265022};
	
	if (n < 4759123141LL) {
		for (lli x : v[0]) {
			if (!millerRabin(n, x)) return false;
		}
		return true;
	}
	if (n < 1122004669633LL) {
		for (lli x : v[1]) {
			if (!millerRabin(n, x)) return false;
		}
		return true;
	}
	if (n < 3474749660383LL) {
		for (lli x : v[2]) {
			if (!millerRabin(n, x)) return false;
		}
		return true;
	}
	for (lli x : v[3]) {
		if (!millerRabin(n, x)) return false;
	}
	return true;
}

void solve() {
	int n, m, k;
	cin >> n >> m >> k;
	
	vector<string> vs(n);
	for (auto &x : vs) {
		cin >> x;
	}
	
	int tok = 1;
	Vector<int> ans(n, vector<int>(m, 0));
	for (int i = 0; i < n; ++i) {
		bool flag = false;
		for (int j = 0; j < m; ++j) {
			ans[i][j] = tok;
			if (vs[i][j] == '#') {
				++tok;
				flag = true;
			}
		}
		if (!flag) {
			for (int j = 0; j < m; ++j) {
				ans[i][j] = 0;
			}
		}
		else {
			for (int j = m-1; j >= 0; --j) {
				if (vs[i][j] == '#') break;
				ans[i][j] = tok - 1;
			}
		}
	}
	
	for (int j = 0; j < m; ++j) {
		for (int i = 0; i < n; ++i) {
			if (ans[i][j]) {
				for (int l = i-1; l >= 0; --l) {
					if (ans[l][j]) break;
					ans[l][j] = ans[i][j];
				}
			}
		}
	}
	
	for (int j = 0; j < m; ++j) {
		for (int i = 0; i < n; ++i) {
			if (ans[i][j]) {
				for (int l = i+1; l < n; ++l) {
					if (ans[l][j]) break;
					ans[l][j] = ans[i][j];
				}
			}
		}
	}
	
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			cout << ans[i][j] << " ";
		}
		cout << "\n";
	}
}

int main() {
	int t = 1;
	// cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 1280