#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rng(a) a.begin(),a.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main() {
  int h, w, k;
  cin >> h >> w >> k;
  vector<vector<char>> tab(h,vector<char>(w));
  vector<vector<int>> ans(h,vector<int>(w+1));

  rep(i,h) {
    rep(j,w) cin >> tab[i][j];
  }

  int cnt = 0;
  rep(i,h) {
    bool ok = false;
    rep(j,w) {
      if(tab[i][j]=='#') {
        cnt++;
        ok = true;
      }
      ans[i][j] = cnt;
      if(!ok) ans[i][j]++;//まだ#が出ていない
    }
    ans[i][w] = cnt;
    //行に#を含まない時
    if(i!=0&&!ok) { 
      rep(j,w) ans[i][j] = ans[i-1][j];
    }
  }
  for(int i = h-2; i >= 0; i--) {
    if(ans[i][w]==0) rep(j,w) ans[i][j] = ans[i+1][j];
  }

  rep(i,h) {
    rep(j,w) cout << ans[i][j] << " ";
    cout << endl;
  }
  return 0;
}