import numpy as np

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

grid=np.empty((h,w),dtype="<U")

for i in range(h):

    s=list(eval(input()))

    grid[i]=s



del_row=[]

del_col=[]

for i in range(h):

    if all(grid[i]=="."):

        del_row.append(i)

for j in range(w):

    if all(grid[:,j]=="."):

        del_col.append(j)

        

grid=np.delete(grid, del_row, 0)

grid=np.delete(grid, del_col, 1)



for i in grid:

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

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

grid = np.array([list(eval(input())) for _ in range(H)], dtype="U1")



row = []

col = []

for i in range(H):

    if (grid[i] != ".").any():

        row.append(i)



trans_grid = np.transpose(grid)

for i in range(W):

    if (trans_grid[i] != ".").any():

        col.append(i)





G = grid[row][:, col]

for g in G:

    print(("".join(g)))
import numpy as np

h, w = list(map(int, input().split()))
grid = np.empty((h, w), dtype="<U")
for i in range(h):
    s = list(eval(input()))
    grid[i] = s
del_row = []
del_col = []
for i in range(h):
    if all(grid[i] == "."):
        del_row.append(i)
for j in range(w):
    if all(grid[:, j] == "."):
        del_col.append(j)
grid = np.delete(grid, del_row, 0)
grid = np.delete(grid, del_col, 1)
for i in grid:
    print(("".join(i)))

import numpy as np

H, W = list(map(int, input().split()))
grid = np.array([list(eval(input())) for _ in range(H)], dtype="U1")
row = []
col = []
for i in range(H):
    if (grid[i] != ".").any():
        row.append(i)
trans_grid = np.transpose(grid)
for i in range(W):
    if (trans_grid[i] != ".").any():
        col.append(i)
G = grid[row][:, col]
for g in G:
    print(("".join(g)))

-h, w = list(map(int, input().split())) -grid = np.empty((h, w), dtype="<U") -for i in range(h): -    s = list(eval(input())) -    grid[i] = s -del_row = [] -del_col = [] -for i in range(h): -    if all(grid[i] == "."): -        del_row.append(i) -for j in range(w): -    if all(grid[:, j] == "."): -        del_col.append(j) -grid = np.delete(grid, del_row, 0) -grid = np.delete(grid, del_col, 1) -for i in grid: -    print(("".join(i))) +H, W = list(map(int, input().split())) +grid = np.array([list(eval(input())) for _ in range(H)], dtype="U1") +row = [] +col = [] +for i in range(H): +    if (grid[i] != ".").any(): +        row.append(i) +trans_grid = np.transpose(grid) +for i in range(W): +    if (trans_grid[i] != ".").any(): +        col.append(i) +G = grid[row][:, col] +for g in G: +    print(("".join(g)))