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.

Input

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.

Output

Output the required rectangle of the minimum cost. Study the output data in the sample tests to understand the output format better.

Examples

Input

6 7
.......
..***..
..*....
..***..
..*....
..***..


Output

***
*..
***
*..
***


Input

3 3
***
*.*
***


Output

***
*.*
***
import sys
def rr(): return sys.stdin.readline().rstrip()
#def perr(*args, end="\n"): sys.stderr.write(" ".join(map(str, args))+end)
def rri(): return int(rr())
def rrl(): return list(map(int, rr().split()))
def rrt(): return tuple(map(int, rr().split()))
def rrle(): return (line.rstrip() for line in sys.stdin.readlines())
def rrtl(): return [tuple(map(int, l.split())) for l in rrle()]
from collections import defaultdict
def mus(d=lambda: 0): return defaultdict(lambda: defaultdict(d))
def dd0(d=lambda: 0): return defaultdict(d)
def ms(x, y, d=0): return [[0]*y for i in range(x)]
def ar(x, d=0): return [d]*x
def ppm(m, n=0, x=0, y=0): print("\n".join(("\t".join((str(m[j][i]) for j in range(y or n))) for i in range(x or n))))
def ppa(a, n): print("\t".join(map(str, a[0:n])))
def ppl(a=0, x=[1]): x[0]=a or (x[0]+1); print("-"+"- -"*14+"-# "+str(x[0]-2)+" #-"+"- -"*14+"-")
def fltn(a): (i for sub in a for i in sub)
def yn(x): return "YES" if x else "NO"
from itertools import accumulate
from itertools import groupby
from itertools import permutations
def grp(x, key=None): return ((i, sum(1 for _ in g)) for i, g in groupby(x, key=key))
import math
def rnar(): return (*rrl(), rrl())
def rn(): return (*rrl(),)
def dpp(a, b=""): print("#| {} |#:^ {} ^:".format(a, b))
MOD17 = 10**9 + 7

def read():
    rrl()
    return (list(rrle()),)

def solve(matrix):

    for row_num, row in enumerate(matrix):
        for col_num, it in enumerate(row):
            if it == "*": break
        else:
            continue
        break
    top = row_num
    for row_num, row in reversed(list(enumerate(matrix))):
        for col_num, it in enumerate(row):
            if it == "*": break
        else:
            continue
        break
    bot = row_num

    for cur_c in range(len(matrix[0])):
        for cur_r in range(len(matrix)):
            if matrix[cur_r][cur_c] == "*": break
        else:
            continue
        break
    left = cur_c

    for cur_c in range(len(matrix[0])-1, -1, -1):
        for cur_r in range(len(matrix)):
            if matrix[cur_r][cur_c] == "*": break
        else:
            continue
        break
    right = cur_c
    fp = (top, left)
    sp = (bot, right)

    ans = []
    for row_num in range(fp[0], sp[0]+1):
        cur_row = []
        for col_num in range(fp[1], sp[1]+1):
            cur_row.append(matrix[row_num][col_num])
        ans.append("".join(cur_row))

    ans = "\n".join(ans)
    return ans

if __name__ == "__main__":
    #test_count = rri()
    test_count = 1
    for _ in range(test_count):
        input_data = read()
        result = solve(*input_data)
        print(result)
