//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
 
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

#define pb push_back
#define pp pop_back
#define F first
#define S second
#define endl "\n"
#define ll long long                                                 
#define ld long double	
#define lb lower_bound
#define ub upper_bound

//template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;

void INeedIT() {ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}

int c[500][500];
vector < pair <int, int> > v; 

int main () {
	INeedIT();
	int h, w, k;
	cin >> h >> w >> k;
	for (int i = 1; i <= h; i++) {
		string s;
		cin >> s;
		for (int j = 0; j < w; j++) {
			if (s[j] == '#') {
				c[i][j + 1]=k;
				k--;
				v.pb({i, j + 1});
			}
			else {
				c[i][j+1]=0;
			}
		}
	}
	for (int i=0;i<v.size();i++) {
		for (int x = v[i].S + 1;x <= w; x++) {
			if (c[v[i].F][x] != 0) {
				break;
			}
			else {
				c[v[i].F][x] = c[v[i].F][v[i].S];
			}
		}
	}
	for (int i=0;i<v.size();i++) {
		for (int x = v[i].S - 1;x >= 1; x--) {
			if (c[v[i].F][x] != 0) {
				break;
			}
			else {
				c[v[i].F][x] = c[v[i].F][v[i].S];
			}
		}
	}
	for (int i=0;i<v.size();i++) {
		for (int y = v[i].F + 1; y <= h; y++) {
			if (c[y][v[i].S] != 0) {
				break;
			}
			else {
				c[y][v[i].S] = c[v[i].F][v[i].S];
			}
		}
	}
	for (int i=0;i<v.size();i++) {
		for (int y = v[i].F - 1; y >= 1; y--) {
			if (c[y][v[i].S] != 0) {
				break;
			}
			else {
				c[y][v[i].S] = c[v[i].F][v[i].S];
			}
		}
	}
	for (int i=1;i<=h;i++) {
		for (int j=1;j<=w;j++) {
			cout<<c[i][j];
		}
		cout<<endl;
	}
	return 0;
}	