h, w = map(int, input().split())
tenki = [[-1 for i in range(w)] for j in range(h)]

for i in range(h):
    temp = list(input())
    cloud = -1
    for j in range(w):
        if temp[j] == '.':
            if cloud != -1:
                cloud += 1
                tenki[i][j] = cloud
        else:
            cloud = 0
            tenki[i][j] = cloud

for i in tenki:
    for j in i:
        print(j, end=" ")
    print()

a0c5b1c30e6df3ccc846339f6d577b4790abcaa3
<mask token>

<mask token>
for i in range(h):
    temp = list(input())
    cloud = -1
    for j in range(w):
        if temp[j] == '.':
            if cloud != -1:
                cloud += 1
                tenki[i][j] = cloud
        else:
            cloud = 0
            tenki[i][j] = cloud
for i in tenki:
    for j in i:
        print(j, end=' ')
    print()

h, w = map(int, input().split())
tenki = [[(-1) for i in range(w)] for j in range(h)]
for i in range(h):
    temp = list(input())
    cloud = -1
    for j in range(w):
        if temp[j] == '.':
            if cloud != -1:
                cloud += 1
                tenki[i][j] = cloud
        else:
            cloud = 0
            tenki[i][j] = cloud
for i in tenki:
    for j in i:
        print(j, end=' ')
    print()

h, w = map(int, input().split())
tenki = [[-1 for i in range(w)] for j in range(h)]

for i in range(h):
    temp = list(input())
    cloud = -1
    for j in range(w):
        if temp[j] == '.':
            if cloud != -1:
                cloud += 1
                tenki[i][j] = cloud
        else:
            cloud = 0
            tenki[i][j] = cloud

for i in tenki:
    for j in i:
        print(j, end=" ")
    print()
