/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

//code by lynmisakura.wish to be accepted!
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

/***************************/
using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<long long> vl;
typedef pair<ll, ll> pi;
typedef vector<pair<ll, ll>> vpi;

//const long long INF = 1LL << 55;

#define itn ll
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ss second
#define ff first
#define dup(x,y) ((x) + (y) - 1)/(y)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(ll i = 0;i < n;i++)
#define rep(i,n) for(ll i = 0;i < n;i++)
#define flush fflush(stdout)
#define rrep(i,n) for(ll i = n - 1;i >= 0;i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define ioboost cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, ll mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }

#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

class CStrawberryCakes {
public:
    static constexpr int kStressIterations = 0;
    static void generateTest(std::ostream& test) {
    }
    char grid[310][310];
    int ans[310][310];
    int count;
    int h,w,k;
    vector<int> berry[310];
    void solve(std::istream& cin, std::ostream& cout) {
        cin >> h >> w >> k;
        count = 1;
        rep(i,h)rep(j,w){
                cin >> grid[i][j];
                if(grid[i][j] == '#'){
                    berry[i].push_back(j);
                }
            }

        vector<int> col;
        //横方向に全部塗りつけた
        for(int x = 0;x < h;x++){
            int m = berry[x].size();
            if(m == 0)continue;

            berry[x].push_back(w);
            for(int i = 0;i < m;i++){
                int yy = berry[x][i];
                int yn = berry[x][i+1];
                if(i == 0){
                    for(int y = 0;y < yy;y++){
                        ans[x][y] = count;
                    }
                }
                for(int y = yy;y < yn;y++){
                    ans[x][y] = count;
                }
                count++;
            }
            //塗った行の番号を入れておく
            col.push_back(x);
        }

        col.push_back(h);
        //縦方向に塗りつける
        int sz = col.size();

        for(int ix = 0;ix < sz;ix++){
            if(ix == 0){
                //一番上から全部塗っておく
                for(int x = 0;x < col[0];x++){
                    for(int y = 0;y < w;y++){
                        ans[x][y] = ans[col[0]][y];
                    }
                }
            }

            //自分より下で塗ってない奴を自分色に染める
            int xx = col[ix],nx = col[ix+1];
            for(int x = xx;x < nx;x++){
                for(int y = 0;y < w;y++){
                    ans[x][y] = ans[xx][y];
                }
            }
        }

        //出力
        for(int i =0;i < h;i++){
            for(int j=0;j<w;j++){
                cout << ans[i][j] << " ";
            }
            cout << endl;
        }

    }
};

int main() {
	CStrawberryCakes solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 1792