A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with *n* rows and *m* columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, but because of the world economic crisis and high oil prices, he wants to send his creation, but to spend as little money as possible. For each sent square of paper (no matter whether it is shaded or not) Bob has to pay 3.14 burles. Please, help Bob cut out of his masterpiece a rectangle of the minimum cost, that will contain all the shaded squares. The rectangle's sides should be parallel to the sheet's sides.
The first line of the input data contains numbers *n* and *m* (1 ≤ *n*, *m* ≤ 50), *n* — amount of lines, and *m* — amount of columns on Bob's sheet. The following *n* lines contain *m* characters each. Character «.» stands for a non-shaded square on the sheet, and «*» — for a shaded square. It is guaranteed that Bob has shaded at least one square.
6 7
.......
..***..
..*....
..***..
..*....
..***..
***
*..
***
*..
***
3 3
***
*.*
***
***
*.*
***
1 1
*
*
2 1
*
*
*
*
5 1
.
*
.
.
.
*
1 6
*****.
*****
2 2
..
*.
*
8 2
..
..
..
..
..
*.
..
..
*
50 1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
*
.
*
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
*
.
.
.
.
.
.
.
.
.
.
.
.
.
.
*
.
*
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
*
2 1
*
.
*
5 1
*
*
*
*
*
*
*
*
*
*
2 2
*.
..
*
3 4
...*
*...
..*.
...*
*...
..*.
8 2
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
50 1
.
*
*
*
.
.
*
.
*
*
*
*
*
*
*
.
*
*
*
*
*
*
*
*
*
*
*
*
*
.
.
.
.
*
*
.
*
*
.
.
.
.
*
*
.
.
.
.
.
.
*
*
*
.
.
*
.
*
*
*
*
*
*
*
.
*
*
*
*
*
*
*
*
*
*
*
*
*
.
.
.
.
*
*
.
*
*
.
.
.
.
*
*
def getInput():
       #n and m are the sizes of board
       n,m =map(int,input().strip().split())
       #get input board
       board = []
       # in range m-1, because we start from 0
       for _ in range(m-1):
              #store each char on its index
              board.append(list([char for char in input()]))
       return board
def removeUnnecessaryFields(board):
       #iterate over boards from top until met a *
       row = 0
       while row < len(board):
              #set to be deleted as True
              delete = True
              #iterate over each char
              for char in board[row]:
                     #if we met a *
                     if char == '*':
                            #this row shouldn't be deleted
                            delete = False
                            #don't look forword, because we don't want to split our drawing in 2
                            break
              #if deleted is true, than we have only ....
              if delete:
                     #we remove the row
                     board.remove(board[row])
                     #but we want to remain on the same position
                     row -= 1
              row += 1
       #do all the steps above, but for bottom-top direction
       row = len(board)-1
       while row > 0:
              delete = True
              for char in board[row]:
                     if char == '*':
                            delete = False
                            break
              if delete:
                     board.remove(board[row])
                     row += 1
              row -= 1
       return board
def main():
       board = getInput()
       partiallyCleanedBoard = removeUnnecessaryFields(board)
       #change columns with rows
       reversedBoard = list(map(list, zip(*partiallyCleanedBoard)))
       #remove unnecessary columns
       cleanedBoard = removeUnnecessaryFields(reversedBoard)
       #undo the above reverse operation
       undoReversedBoard = list(map(list, zip(*cleanedBoard)))
       #print the result
       for resultLetter in undoReversedBoard:
              print(' '.join(resultLetter))
main()