#include <cstdio>
#include <cstring>

const int MaxN = 300 + 5, MaxM = 300 + 5;

int N, M, K;
char S[MaxN][MaxM];
int A[MaxN][MaxM];

void init() {
  scanf("%d %d %d", &N, &M, &K);
  for (int i = 1; i <= N; ++i)
    scanf("%s", S[i] + 1);
}

void solve() {
  int preLine = 0, id = 0;
  for (int i = 1; i <= N; ++i) {
    bool have = false;
    for (int j = 1; j <= M; ++j)
      if (S[i][j] == '#') have = true;
    if (have == false) continue;
    int p = 0;
    for (int j = 1; j <= M; ++j) {
      if (S[i][j] == '.') continue;
      id++;
      for (int k = p + 1; k <= j; ++k) A[i][k] = id;
      p = j;
    }
    for (int j = p + 1; j <= M; ++j) A[i][j] = A[i][p];
    for (int k = preLine + 1; k < i; ++k)
      memcpy(A[k], A[i], sizeof A[i]);
    preLine = i;
  }
  for (int i = preLine + 1; i <= N; ++i)
    memcpy(A[i], A[preLine], sizeof A[preLine]);
  for (int i = 1; i <= N; ++i)
    for (int j = 1; j <= M; ++j)
      printf("%d%c", A[i][j], " \n"[j == M]);
}

int main() {
  init();
  solve();
  return 0;
}