import numpy as np

H, W = list(map(int, input().split()))



a = np.array([list(eval(input())) for i in range(H)])



at = np.all(a == '.', axis = 1)

for i in reversed(list(range(len(at)))):

  if at[i]:

    a = np.delete(a, i, 0)



at = np.all(a == '.', axis = 0)

for i in reversed(list(range(len(at)))):

  if at[i]:

    a = np.delete(a, i, 1)

for i in a:

  print((''.join(i)))
H, W = list(map(int, input().split()))



a = [list(eval(input())) for i in range(H)]



for i in reversed(list(range(len(a)))):

  if '#' not in a[i]:

    del a[i]



a = list(zip(*a))

for i in reversed(list(range(len(a)))):

  if '#' not in a[i]:

    del a[i]



a = list(zip(*a))

         

for i in a:

  print((''.join(i)))
import numpy as np

H, W = list(map(int, input().split()))
a = np.array([list(eval(input())) for i in range(H)])
at = np.all(a == ".", axis=1)
for i in reversed(list(range(len(at)))):
    if at[i]:
        a = np.delete(a, i, 0)
at = np.all(a == ".", axis=0)
for i in reversed(list(range(len(at)))):
    if at[i]:
        a = np.delete(a, i, 1)
for i in a:
    print(("".join(i)))

H, W = list(map(int, input().split()))
a = [list(eval(input())) for i in range(H)]
for i in reversed(list(range(len(a)))):
    if "#" not in a[i]:
        del a[i]
a = list(zip(*a))
for i in reversed(list(range(len(a)))):
    if "#" not in a[i]:
        del a[i]
a = list(zip(*a))
for i in a:
    print(("".join(i)))

-import numpy as np - -a = np.array([list(eval(input())) for i in range(H)]) -at = np.all(a == ".", axis=1) -for i in reversed(list(range(len(at)))): -    if at[i]: -        a = np.delete(a, i, 0) -at = np.all(a == ".", axis=0) -for i in reversed(list(range(len(at)))): -    if at[i]: -        a = np.delete(a, i, 1) +a = [list(eval(input())) for i in range(H)] +for i in reversed(list(range(len(a)))): +    if "#" not in a[i]: +        del a[i] +a = list(zip(*a)) +for i in reversed(list(range(len(a)))): +    if "#" not in a[i]: +        del a[i] +a = list(zip(*a))