#include <bits/stdc++.h>
using namespace std;

using ll = long long;
#define int long long

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%MOD+MOD)%MOD){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD-a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= MOD; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime MOD
  mint inv() const { return pow(MOD-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
int in() {int x; cin>>x; return x;}
string stin() {string s; cin>>s; return s;}
const int MAX = 300;
int H, W;
int K;
bool cake[MAX][MAX];
int cake_map[MAX][MAX];
int current_index = 1;

void ApplyNum(int start_y, int end_y, int start_x, int end_x) {
  for(int h = start_y; h < end_y; ++h) {
    for(int w = start_x; w < end_x; ++w) {
      cake_map[h][w] = current_index;
    }
  }
  ++current_index;
}
void PrintCakeMap() {
  REP(h, H) {
    REP(w, W) {
      if(w==W-1) {
        COUTB(cake_map[h][w]);
      } else {
        COUTS(cake_map[h][w]);
      }
    }
  }
}
/***** MAIN *****/
signed main() {
  cin >> H >> W >> K;
  vector<int> row_with_sb;
  for(int h = 0; h < H; ++h) {
    for(int w = 0; w < W; ++w) {
      char c;
      cin >> c;
      cake[h][w] = (c == '#');
    }
  }
  for(int h = 0; h < H; ++h) {
    for(int w = 0; w < W; ++w) {
      if(cake[h][w]) {
        row_with_sb.PB(h);
        break;
      }
    }
  }
  
  for(int i = 0; i < row_with_sb.size(); ++i) {
    int start_y = row_with_sb[i];
    int end_y = row_with_sb[i+1];
    // 最初の領域
    if(i == 0) {
      start_y = 0;
    }
    // 最後の領域
    if(i == row_with_sb.size() - 1) {
      end_y = H;
    }

    bool is_first_column = true;  // 最初の列は無視して、2列目以降にイチゴが乗っていたらそれ以降の列の数字を1増加
    int start_x = 0;
    // イチゴがある行を調査する
    for(int w = 0; w < W; ++w) {
      if(cake[row_with_sb[i]][w]) {
        if(is_first_column) {
          is_first_column = false;
          continue;
        }
        // 2番目以降のイチゴを見つけたら、それよりひだりの数字が決定する
        ApplyNum(start_y, end_y, start_x, w);
        start_x = w;
      }
    }
    ApplyNum(start_y, end_y, start_x, W);
  }
  PrintCakeMap();
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 1536