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 java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Math.*;

public class Testt {

    final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
        if (ONLINE_JUDGE) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        } else {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }


    public static void mergeSort(int[] a) {
            mergeSort(a, 0, a.length - 1);
    }

    private static void mergeSort(int[] a, int leftIndex, int rightIndex) {
            final int MAGIC_VALUE = 50;
            if (leftIndex < rightIndex) {
                    if (rightIndex - leftIndex <= MAGIC_VALUE) {
                            insertionSort(a, leftIndex, rightIndex);
                    } else {
                            int middleIndex = (leftIndex + rightIndex) / 2;
                            mergeSort(a, leftIndex, middleIndex);
                            mergeSort(a, middleIndex + 1, rightIndex);
                            merge(a, leftIndex, middleIndex, rightIndex);
                    }
            }
    }

    private static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {
            int length1 = middleIndex - leftIndex + 1;
            int length2 = rightIndex - middleIndex;
            int[] leftArray = new int[length1];
            int[] rightArray = new int[length2];
            System.arraycopy(a, leftIndex, leftArray, 0, length1);
            System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
            for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {
                    if (i == length1) {
                            a[k] = rightArray[j++];
                    } else if (j == length2) {
                            a[k] = leftArray[i++];
                    } else {
                            a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];
                    }
            }
    }

    private static void insertionSort(int[] a, int leftIndex, int rightIndex) {
            for (int i = leftIndex + 1; i <= rightIndex; i++) {
                    int current = a[i];
                    int j = i - 1;
                    while (j >= leftIndex && a[j] > current) {
                            a[j + 1] = a[j];
                            j--;
                    }
                    a[j + 1] = current;
            }
    }
    
    public static void main(String[] args) {
        new Testt().run();
    }

    public void run() {
        try {
            long t1 = System.currentTimeMillis();
            init(); 
            solve();
            out.close();
            long t2 = System.currentTimeMillis();
            System.err.println("Time = " + (t2 - t1));
        } catch (Exception e) {
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }
    int mini=Integer.MAX_VALUE;
    int maxi=Integer.MIN_VALUE;
    int ans=0;
    int ans2=0;
    
    void solve() throws IOException {
        int n = readInt();
        int m = readInt();
        char c [] [] = new char [n][m];
        for (int i =0; i<n; i++)
        {
            String s = readString();
            for (int j = 0; j<m; j++)
                c[i][j] = s.charAt(j);
        }
        int minj=Integer.MAX_VALUE;
        int maxj=Integer.MIN_VALUE;
        for (int i =0; i<n;i++)
            for (int j =0; j<m;j++){
                if (c[i][j]=='*'){
                    mini=min(i,mini);
                    minj=min(j,minj);
                    maxi=max(i,maxi);
                    maxj=max(j,maxj);
                }
            }
        if (mini==maxi && minj==maxj) {out.print(c[mini][maxj]); return;}
        for(int i =min(mini,maxi); i<=max(mini,maxi);i++){
            for (int j = min(minj,maxj); j<=max(minj,maxj); j++)
                out.print(c[i][j]);
            out.println();
        }
        
        }
        
    
    
    
    
    
    
    
    
    
    
    void printMatrix(int n, int m, int x[][]){
        for (int i =0; i<n; i++){
            for (int j =0; j<m; j++)
                out.print(x[i][j]+ " ");
        out.println();
        }
    }
    
    
    
    
    
    
    
    
    
    


void per (int left, int right, int [] a){
// work (0,n)  !!! a[i]=(0,1,2,3...);
    if (left==right) {
        for (int i = 0; i <right; i++){
            out.print(a[i]);
        }
        out.println();
    }
    else{
        for (int i=left;  i<right; i++){
            int k = a[left];
            a[left]=a[i];
            a[i]=k;
            per(left+1,right, a);
            k = a[left];
            a[left]=a[i];
            a[i]=k;
        }
    }
 }
}
/*
 *  int k = readInt();
        int n = readInt();
        int m = readInt();
        ArrayList<String>[][]   a = new ArrayList[k][n];
        for (int i =0; i<n; i++)
            for (int j = 0; j<n; j++)
                a[i][j] = new ArrayList<String>();
                
        for (int i =0; i<k; i++)
            for (int j = 0; j<n; j++)
                for (int z = 0; z<m; z++){
                    String w = readString();
                    a[i][j].add(w);
                }
        int r = readInt();
        int e = readInt();
        for (int i =0; i<n; i++){
            for (int j = 0; j<n; j++){
                for (int z = 0; z<n; z++){
                    out.print(a[i][j].get(z));
                }
            out.println("-");
            }
        out.println("--");
    }
}
 */

