#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
using P =pair<int,int>;
//int dy[4] = {-1,0,1,0};
//int dx[4] = {0,-1,0,1};


int main()
{
    int H,W,K;
    cin >> H >> W >> K;
    
    vector<string> data(H);
    for(int i=0;i<H;i++)
    {
        cin >> data[i];
    }
    
    Graph ans(H,vector<int>(W,0));
    bool firstcheck = false;
    bool next = true;
    
    int mmm = 0;
    
    for(int i=0;i<H;i++)
    {
        bool saw = false;
        
        bool used = false;
        for(int j=0;j<W;j++)
        {
            if(data[i][j] == '#')
            {
                firstcheck = true;
                mmm++;
                saw = true;
                ans[i][j] = mmm;
                used = true;
            }
            else if(used)
            {
                ans[i][j] = ans[i][j-1];
            }
        }
        if(used)
        {
            for(int j = W-1;j>=0;j--)
            {
                if(ans[i][j] == 0)
                {
                    ans[i][j] = ans[i][j+1];
                }
            }
        }
        
        if(firstcheck && next)
        {
            next = false;
            for(int k=0;k<i;k++)
            {
                for(int j=0;j<W;j++)
                {
                    ans[k][j] = ans[i][j];
                }
                
            }
        }
        if(firstcheck && !saw)
        {
            for(int j=0;j<W;j++)
            {
                ans[i][j] = ans[i-1][j];
            }
        }
    }
    
    for(int i=0;i<H;i++)
    {
        for(int j=0;j<W-1;j++)
        {
            cout << ans[i][j] << " ";
        }
        cout << ans[i][W-1] << endl;
    }
    
    
}

/*
bool dfs(vector<vector<P>> &data, vector<long long> &d, queue<int> &temp)
{
    while(!temp.empty())
    {
    int i= temp.front();
    temp.pop();
    for(int j=0;j<data[i].size();j++)
    {
        if(d[data[i][j].first] == LONG_LONG_MAX)
        {
            d[data[i][j].first] = d[i] + data[i][j].second;
            temp.push(data[i][j].first);
            
        }
        else if(d[data[i][j].first] != d[i] + data[i][j].second)
        {
            return false;
            break;
        }
    }
    }
    return true;
}


int main()
{
    int N,M;
    cin >>N >> M;
    
    vector<vector<P>> data(N);
    for(int i=0;i<M;i++)
    {
        int a,b,c;
        cin >> a >> b >> c;
        
        data[a-1].push_back(make_pair(b-1,c));
        data[b-1].push_back(make_pair(a-1,-c));
    }
    
    vector<long long> d(N,LONG_LONG_MAX);
    bool nouse = false;
    if(data[0].size() != 0) d[0] = 0;
    else nouse = true;
    
    bool ok = true;
    
    int k=0;
    for(int i=0;i<N;i++)
    {
        for(int j=0;j<data[i].size();j++)
        {
            if(nouse)
            {
                d[i] = 0;
                nouse = false;
                k=i;
                break;
            }
        }
    }
    
    /*
            }
            if(d[data[i][j].first] == LONG_LONG_MAX)
            {
                d[data[i][j].first] = d[i] + data[i][j].second;
            }
            else if(d[data[i][j].first] != d[i] + data[i][j].second)
            {
                ok = false;
                break;
            }
        }
        if(!ok)
        {
            break;
        }
 
    
    
    queue<int> temp;
    temp.push(k);
    if(dfs(data,d,temp)) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}
*/







Measured memory_bytes: 1280