#include<bits/stdc++.h>
using namespace std;
const int N=309;
int n,m,k;
char a[N][N];
bool hav[N];
int ans[N][N]; 
void solve(vector<int>h,int x,int &g){
  int bg=1,ed=1;
  while(ed<=m&&a[x][ed]=='.')ed++;
  while(bg<=m){
    //cout<<x<<" "<<bg<<" "<<ed<<endl;
    while(ed+1<=m&&a[x][ed+1]=='.')ed++;
      g++;
      for(auto i:h)
        for(int j=bg;j<=ed;j++)ans[i][j]=g;
    bg=ed+1;ed=bg;
  } 
}                                  
int main(){
//  freopen("out.txt","w",stdout);
  cin>>n>>m>>k;
  for(int i=1;i<=n;i++)
    for(int j=1;j<=m;j++)cin>>a[i][j],hav[i]|=(a[i][j]=='#');
  int cnt=0;
  vector<int>h;
  int i=1;
  while(i<=n&&!hav[i])h.push_back(i),i++;
  while(i<=n){
    h.push_back(i),i++;
    int x=i-1;
    while(i<=n&&!hav[i])h.push_back(i),i++;
    solve(h,x,cnt);
    h.clear();
  }
  for(int i=1;i<=n;i++){
    for(int j=1;j<=m;j++)cout<<ans[i][j]<<" ";
    cout<<endl;
  }
  return 0;
} 