#include <bits/stdc++.h>
#define rep(i,l,r) for (int i=l,i##end=r;i<=i##end;++i)
#define per(i,r,l) for (int i=r,i##end=l;i>=i##end;--i)
using namespace std;
const int N=1003;
int a[N][N],b[N],f[N][N];
int main(){
    int n,m,k; cin>>n>>m>>k;
    rep(i,1,n){
        static char s[N]; scanf("%s",s);
        rep(j,1,m) b[i]|=(a[i][j]=s[j-1]=='#');
    }
    int c=1;
    rep(i,1,n){
        if (b[i]){
            int t=0;
            rep(j,1,m){
                if (a[i][j]){
                    if (t) ++c; t=1;
                }
                f[i][j]=c;
            }
            ++c;
        }
        else rep(j,1,m) f[i][j]=f[i-1][j];
    }
    rep(i,1,n)
        if (b[i]){
            per(j,i-1,1)
                rep(k,1,m) f[j][k]=f[j+1][k];
            break;
        }
    rep(i,1,n){
        rep(j,1,m) printf("%d ",f[i][j]);
        putchar('\n');
    }
    return 0;
}
