#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <limits.h>
#include <bitset>
#include <math.h>
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
using prique = priority_queue<int>;
const int MOD = 10007;
const int INF = LLONG_MAX/3;
const int MAX = 710000;

/*-----Library-----*/

struct UnionFind {
    vector<int> par; // 親ノード
    vector<int> rank; // ランク
    vector<int> sizeuf; //要素数
    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        par.resize(n); rank.resize(n); sizeuf.resize(n);
        for (int i = 0; i < n; ++i) {
            par[i] = i;
            rank[i] = 0;
            sizeuf[i]=1;
        }
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        sizeuf[x]+=sizeuf[y];
        return true;
    }

    int size(int x){
        return sizeuf[root(x)];
    }
};

long long gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}

long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}

long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

/*-----Library-----*/
int a[310][310];
int h,w;
int k;
char c[310][310];
int cnt=1;
void gyou(int s){
    bool nai=true;
    for(int i=0;i<w;i++){
        if(c[s][i]=='#')nai=false;
    }
    if(nai==true&&s==0){
        int m=1;
        while(1){
            bool nai=true;
            for(int i=0;i<w;i++){
                if(c[m][i]=='#')nai=false;
            }
            if(nai==false)break;
            m++;
        }
        gyou(m);
        for(int i=0;i<m;i++){
            for(int j=0;j<w;j++){
                a[i][j]=a[m][j];
            }
        }
    }else if(nai==true){
        for(int i=0;i<w;i++){
            a[s][i]=a[s-1][i];
        }
        if(s!=h-1)gyou(s+1);
    }else{
        for(int i=0;i<w;i++){
            if(c[s][i-1]=='#')cnt++;
            a[s][i]=cnt;
        }
        int m=w-1;
        while(1){
            if(c[s][m]=='#')break;
            a[s][m]--;
            m--;
        }
        if(c[s][w-1]=='#')cnt++;
        if(s!=h-1)gyou(s+1);
    }
}
signed main(){
    cin>>h>>w;
    cin>>k;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            a[i][j]=-1;
        }
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>c[i][j];
        }
    }
    gyou(0);
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cout<<a[i][j]<<" ";
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 1664