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.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
import java.util.StringTokenizer;

public class A {

	public static void main(String[] Args) throws IOException {
		new A().solve();
	}

	static int[] dx_ = { 0, 0, 1, -1 };
	static int[] dy_ = { 1, -1, 0, 0 };

	ArrayList<Integer>[] graph;

	ArrayList<Point> map = new ArrayList<Point>();

	// DISCUSS TIME LIMIT EXCEEDED!!!! PROPER DATA STRUCTURE!!!
	// Use array if possible or the most efficient data structure
	void solve() throws IOException {
		int r = si(), c = si();
		int rmin = r, rmax = 0, cmin = c, cmax = 0;
		char[][] v = new char[r][c];
		for (int i = 0; i < r; i++) {
			v[i] = ss().toCharArray();
			if (new String(v[i]).contains("*")) {
				rmin = Math.min(rmin, i);
				rmax = Math.max(rmax, i);
			}
			for (int j = 0; j < v[i].length; j++) {
				if (v[i][j] == '*') {
					cmin = Math.min(cmin, j);
					cmax = Math.max(cmax, j);
				}
			}
		}

		for (int i = rmin; i <= rmax; i++) {
			for (int j = cmin; j <= cmax; j++) {
				System.out.print(v[i][j]);
			}
			System.out.println("");
		}
	}

	// ----------------------- Library ------------------------

	// ----------------------- GRAPH ------------------------

	/**
	 * important for speed!!! PrintWriter out=new PrintWriter(new
	 * OutputStreamWriter(System.out)); out.print(...); out.close();
	 * 
	 * @param v
	 */
	// leap year is 29
	int[] year = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

	void initSystem() throws IOException {
		if (br != null)
			br.close();
		br = new BufferedReader(new InputStreamReader(System.in));
	}

	void initFile() throws IOException {
		if (br != null)
			br.close();
		br = new BufferedReader(new InputStreamReader(new FileInputStream(
				"input.txt")));
	}

	void printWriter() {
		try {
			PrintWriter pr = new PrintWriter("output.txt");
			pr.println("hello world");
			pr.close();
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	void comparator() {
		Point[] v = new Point[10];
		Arrays.sort(v, new Comparator<Point>() {
			@Override
			public int compare(Point a, Point b) {
				if (a.x != b.x)
					return -(a.x - b.x);
				return a.y - b.y;
			}
		});
	}

	double distance(Point a, Point b) {
		double dx = a.x - b.x, dy = a.y - b.y;
		return Math.sqrt(dx * dx + dy * dy);
	}

	Scanner in = new Scanner(System.in);

	String ss() {
		return in.next();
	}

	char[] sc() {
		return in.next().toCharArray();
	}

	String sline() {
		return in.nextLine();
	}

	int si() {
		return in.nextInt();
	}

	long sl() {
		return in.nextLong();
	}

	int[] sai(int n) {
		int[] a = new int[n];
		for (int i = 0; i < a.length; i++) {
			a[i] = in.nextInt();
		}
		return a;
	}

	int[] si(int n) {
		int[] a = new int[n];
		for (int i = 0; i < a.length; i++) {
			a[i] = in.nextInt();
		}
		return a;
	}

	String[] ss(int n) {
		String[] a = new String[n];
		for (int i = 0; i < a.length; i++) {
			a[i] = ss();
		}
		return a;
	}

	int[] sai_(int n) {
		int[] a = new int[n + 1];
		for (int i = 1; i <= n; i++) {
			a[i] = in.nextInt();
		}
		return a;
	}

	BufferedReader br;
	StringTokenizer tokenizer;
	{
		br = new BufferedReader(new InputStreamReader(System.in));
	}

	void tok() throws IOException {
		tokenizer = new StringTokenizer(br.readLine());
	}

	int toki() throws IOException {

		return Integer.parseInt(tokenizer.nextToken());
	}

	int[] rint(int n) throws IOException {
		int[] a = new int[n];
		for (int i = 0; i < a.length; i++)
			a[i] = Integer.parseInt(tokenizer.nextToken());

		return a;
	}

	int[] rint_(int n) throws IOException {
		int[] a = new int[n + 1];
		for (int i = 1; i <= n; i++)
			a[i] = Integer.parseInt(tokenizer.nextToken());

		return a;
	}

	String[] rstrlines(int n) throws IOException {
		String[] a = new String[n];
		for (int i = 0; i < n; i++) {
			a[i] = br.readLine();
		}
		return a;
	}

	long tokl() {
		return Long.parseLong(tokenizer.nextToken());
	}

	double tokd() {
		return Double.parseDouble(tokenizer.nextToken());
	}

	String toks() {
		return tokenizer.nextToken();
	}

	String rline() throws IOException {
		return br.readLine();
	}

	List<Integer> toList(int[] a) {
		List<Integer> v = new ArrayList<Integer>();
		for (int i : a)
			v.add(i);
		return v;
	}

	static void pai(int[] a) {
		System.out.println(Arrays.toString(a));
	}

	static int toi(Object s) {
		return Integer.parseInt(s.toString());
	}

	static int[] dx3 = { 1, -1, 0, 0, 0, 0 };
	static int[] dy3 = { 0, 0, 1, -1, 0, 0 };
	static int[] dz3 = { 0, 0, 0, 0, 1, -1 };

	static int[] dx = { 1, 0, -1, 1, -1, 1, 0, -1 }, dy = { 1, 1, 1, 0, 0, -1,
			-1, -1 };

	static int INF = 2147483647; // =2^31-1 // -8
	static long LINF = 922337203854775807L; // -8
	static short SINF = 32767; // -32768

	// finds GCD of a and b using Euclidian algorithm
	public int GCD(int a, int b) {
		if (b == 0)
			return a;
		return GCD(b, a % b);
	}

	static List<String> toList(String[] a) {
		return Arrays.asList(a);
	}

	static String[] toArray(List<String> a) {
		String[] o = new String[a.size()];
		a.toArray(o);
		return o;
	}

	static int[] pair(int... a) {
		return a;
	}
}