import sys
line=sys.stdin.readline().strip().split()
n=int(line[0])
m=int(line[1])

chess=list()
for i in range(n):
    lineList=list()
    line=sys.stdin.readline().strip()
    for j in range(m):
        if line[j]=='.':
            lineList.append(0)
        elif line[j]=='o':
            lineList.append(1)
        else:
            lineList.append(2)

    chess.append(lineList)

for j in range(len(chess[0])):
    partCount=0
    partBottomIndex=len(chess)
    colList=[0 for col in range(len(chess))]
    for i in reversed(range(len(chess))):
        if chess[i][j]==1:
            partCount+=1
        elif chess[i][j]==0:
            continue
        else:
            colList[i]=2
            if (partBottomIndex<len(chess)):
                for index in range(partCount):
                    colList[partBottomIndex-index-1]=1
            partCount=0
            partBottomIndex=i
    if (partBottomIndex<len(chess)):      
        for index in range(partCount):
            colList[partBottomIndex-index-1]=1
        

    for index in range(len(chess)):
        chess[index][j]=colList[index]

strList=list()
for i in range(len(chess)):
    string=''
    for j in range(len(chess[0])):
        if chess[i][j]==0:
            string+='.'
        elif chess[i][j]==1:
            string+='o'
        else:
            string+='x'
    strList.append(string)

for string in strList:
    print string