#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
#define endl '\n'
#define pi pair<int, int>

char f[303][303];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int n, m, k;
    cin >> n >> m >> k;

    int ret[n][m];
    for(int i = 0, li = 0; i < n; i++){
        cin >> f[i];
        vector<pi> cur;
        for(int j = 0, lj = 0; j < m; j++){
            if(f[i][j] == '#'){
                cur.push_back({lj, j});
                lj = j + 1;
            }
        }
        if(cur.empty()) continue;

        int X = (cur.size() < k ? i : n - 1);
        cur.back().second = m - 1;
        for(pi p : cur){
            for(int x = li; x <= X; x++){
                for(int y = p.first; y <= p.second; y++){
                    ret[x][y] = k;
                }
            }
            k--;
        }
        li = i + 1;
    }

    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++) cout << " " << ret[i][j];
        cout << endl;
    }

    return 0;
}