import numpy

h, w = list(map(int, input().split()))

a = [list(eval(input())) for _ in range(h)]

a = numpy.asarray(a)

a = a[:, numpy.any(a == "#", axis=0)]

a = a[numpy.any(a == "#", axis=1)]

for i in range(len(a)):

    print(("".join(a[i])))

import numpy

h, w = list(map(int, input().split()))

ls = [list(eval(input())) for _ in range(h)]

ls = numpy.array(ls)

ls = ls[numpy.any(ls == "#", axis=1), :]

ls = ls[:, numpy.any(ls == "#", axis=0)]

for i in list(ls):

    print(("".join(i)))

import numpy

h, w = list(map(int, input().split()))
a = [list(eval(input())) for _ in range(h)]
a = numpy.asarray(a)
a = a[:, numpy.any(a == "#", axis=0)]
a = a[numpy.any(a == "#", axis=1)]
for i in range(len(a)):
    print(("".join(a[i])))

import numpy

h, w = list(map(int, input().split()))
ls = [list(eval(input())) for _ in range(h)]
ls = numpy.array(ls)
ls = ls[numpy.any(ls == "#", axis=1), :]
ls = ls[:, numpy.any(ls == "#", axis=0)]
for i in list(ls):
    print(("".join(i)))

-a = [list(eval(input())) for _ in range(h)] -a = numpy.asarray(a) -a = a[:, numpy.any(a == "#", axis=0)] -a = a[numpy.any(a == "#", axis=1)] -for i in range(len(a)): -    print(("".join(a[i]))) +ls = [list(eval(input())) for _ in range(h)] +ls = numpy.array(ls) +ls = ls[numpy.any(ls == "#", axis=1), :] +ls = ls[:, numpy.any(ls == "#", axis=0)] +for i in list(ls): +    print(("".join(i)))