using System;
using System.Collections.Generic;
using System.Linq;

namespace AC
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadArrayInt();
            var H = input[0];
            var W = input[1];
            var K = input[2];
            var cake = new char[H, W];
            for (int i = 0; i < H; i++)
            {
                var line = Read();
                for (int j = 0; j < W; j++)
                {
                    cake[i, j] = line[j];
                }
            }
            var ans = new int[H, W];
            var cnt = 1;
            for (int i = 0; i < H; i++)
            {
                for (int j = 0; j < W; j++)
                {
                    if (cake[i, j] == '#')
                    {
                        var start = j;
                        var end = j;
                        while (start - 1 >= 0 && ans[i, start - 1] == 0)
                        {
                            start = start - 1;
                        }
                        while (end + 1 < W && ans[i, end + 1] == 0 && cake[i, end + 1] != '#')
                        {
                            end = end + 1;
                        }
                        for (int k = start; k <= end; k++)
                        {
                            ans[i, k] = cnt;
                        }
                        cnt++;
                        j = end;
                    }
                }
            }
            for (int i = 1; i < H; i++)
            {
                var ichigo = true;
                for (int j = 0; j < W; j++)
                {
                    if (ans[i, j] == 0)
                    {
                        ichigo = false;
                        break;
                    }
                }
                if (!ichigo)
                {
                    for (int j = 0; j < W; j++)
                    {
                        ans[i, j] = ans[i - 1, j];
                    }
                }                
            }
            for (int i = H - 2; i >= 0; i--)
            {
                var ichigo = true;
                for (int j = 0; j < W; j++)
                {
                    if (ans[i, j] == 0)
                    {
                        ichigo = false;
                        break;
                    }
                }
                if (!ichigo)
                {
                    for (int j = 0; j < W; j++)
                    {
                        ans[i, j] = ans[i + 1, j];
                    }
                }                
            }
            for (int i = 0; i < H; i++)
            {
                for (int j = 0; j < W; j++)
                {
                    Console.Write(ans[i, j] + " ");
                }
                Console.WriteLine();
            }
            
            Console.WriteLine();
            Console.ReadKey();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 18012