import java.util.Arrays;
import java.util.Scanner;

public class Main {
    static final Scanner sc    = new Scanner(System.in);
    static final int     MOD   = (int) 1E9 + 7;
    static final long    INF_L = (long) 4E18;
    static final char ICHIGO = '#';
    static final char EMPTY = '.';
    
    public static void main(String[] args) {
        int H = nint();
        int W = nint();
        int K = nint();
        char[][] s = nchars2(H, W);
        
        int group = 0;
        int[][] ans = new int[H][W];
        for (int h = 0; h < H; h++) {
            for (int w = 0; w < W; w++) {
                if (s[h][w] == ICHIGO) {
                    group++;
                    ans[h][w] = group;
                }
            }
        }
        
        for (int h = 1; h < H; h++) {
            for (int w = 0; w < W; w++) {
                if (ans[h][w] == 0 && ans[h-1][w] != 0) {
                    ans[h][w] = ans[h-1][w];
                }
            }
        }
        
        for (int h = H-2; h >= 0; h--) {
            for (int w = 0; w < W; w++) {
                if (ans[h][w] == 0 && ans[h+1][w] != 0) {
                    ans[h][w] = ans[h+1][w];
                }
            }
        }
        
        for (int w = 1; w < W; w++) {
            for (int h = 0; h < H; h++) {
                if (ans[h][w] == 0 && ans[h][w-1] != 0) {
                    ans[h][w] = ans[h][w-1];
                }
            }
        }
        
        for (int w = W-2; w >= 0; w--) {
            for (int h = 0; h < H; h++) {
                if (ans[h][w] == 0 && ans[h][w+1] != 0) {
                    ans[h][w] = ans[h][w+1];
                }
            }
        }
        
        for (int h = 0; h < H; h++) {
            for (int w = 0; w < W; w++) {
                System.out.print(ans[h][w]);
                System.out.print(' ');
            }
            System.out.println();
        }
    }
        

    @Deprecated
    static int nint() {
        return sc.nextInt();
    }

    @Deprecated
    static int[] nints(int N) {
        return nints(0, N, 0);
    }

    @Deprecated
    private static int[] nints(int padL, int N, int padR) {
        int[] a = new int[padL + N + padR];
        for (int i = 0; i < N; i++)
            a[padL + i] = nint();
        return a;
    }

    static long nlong() {
        return sc.nextLong();
    }

    static long[] nlongs(int N) {
        return nlongs(0, N, 0);
    }

    static long[] nlongs(int padL, int N, int padR) {
        long[] a = new long[padL + N + padR];
        for (int i = 0; i < N; i++)
            a[padL + i] = nlong();
        return a;
    }

    static double ndouble() {
        return sc.nextDouble();
    }

    static double[] ndoubles(int N) {
        return ndoubles(0, N, 0);
    }

    static double[] ndoubles(int padL, int N, int padR) {
        double[] d = new double[N + padL + padR];
        for (int i = 0; i < N; i++) {
            d[padL + i] = ndouble();
        }
        return d;
    }

    static String nstr() {
        return sc.next();
    }

    static char[] nchars() {
        return sc.next().toCharArray();
    }

    static char[] nchars(int padL, int padR) {
        char[] temp = sc.next().toCharArray();
        char[] ret = new char[temp.length + padL + padR];
        System.arraycopy(temp, 0, ret, padL, temp.length);
        return ret;
    }

    static char[][] nchars2(int H, int W) {
        return nchars2(H, W, 0, 0);
    }

    static char[][] nchars2(int H, int W, int padLU, int padRD) {
        char[][] a2 = new char[H + padLU + padRD][W + padLU + padRD];
        for (int i = 0; i < H; i++)
            System.arraycopy(nchars(), 0, a2[padLU + i], padLU, W);
        return a2;
    }

    static long min(long... ls) {
        return Arrays.stream(ls).min().getAsLong();
    }

    static long max(long... ls) {
        return Arrays.stream(ls).max().getAsLong();
    }

    static long abs(long a) {
        return Math.abs(a);
    }
}


Measured memory_bytes: 47872