#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define test() int t;cin>>t;loop(test,1,t+1)
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define nl cout<<"\n"
#define sp cout<<" "
#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define MOD 1000000007
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

ll mod( ll n, ll m=MOD ){ n%=m,n+=m,n%=m;return n; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

unordered_map<long long, int, custom_hash> safe_map;

const int MAXN = 1e5+5;
const int LOGN = 21;
const ll INF = 1e14;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

char grid[305][305];
int ans[305][305];
vector<int>row[305];

int main() 
{
    fastio();

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

    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            cin>>grid[i][j];
            if( grid[i][j] == '#' )
            {
                row[i].pb(j);
            }
        }
    }

    int cur = 1;
    for(int i=0;i<n;i++)
    {
        if( row[i].size() == 0 ) continue;
        int j = 0;
        for(int l=0;l+1<(int)row[i].size();l++)
        {
            while( j <= row[i][l] )
            {
                ans[i][j] = cur;
                j++;
            }
            cur++;
        }
        while( j < m )
        {
            ans[i][j] = cur;
            j++;
        }
        cur++;
    }

    for(int i=1;i<n;i++)
    {
        if( row[i].empty() && !row[i-1].empty() )
        {
            for(int j=0;j<m;j++)
            {
                ans[i][j] = ans[i-1][j];
            }
            row[i].pb(-1);
        }
    }

    for(int i=n-2;i>=0;i--)
    {
        if( row[i].empty() && !row[i+1].empty() )
        {
            for(int j=0;j<m;j++)
            {
                ans[i][j] = ans[i+1][j];
            }
            row[i].pb(-1);
        }
    }

    set<int>st;
    map<int,int>mp;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            st.insert(ans[i][j]);
        }
    }

    int cnt = 0;
    for( auto x : st )
    {
        mp[x] = cnt++;
        // cout<<x<<" "<<mp[x],nl;
    }

    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            // cout<<ans[i][j]+1<<" ";
            cout<<mp[ans[i][j]]+1<<" ";
        }
        nl;
    }
    return 0;
}

Measured memory_bytes: 10240