read h w;
a=(`grep '#'`);
for((i=0;i<${#a[@]};i++))do
	for((j=0;j<w;j++))do
		f=0;
		for((k=0;k<${#a[@]};k++))do
			if [ ${a[$k]:$j:1} = "#" ];then
				f=1;
			fi
		done
		if [ $f -eq 1 ];then
			echo -n ${a[$i]:$j:1}
		fi
	done
	echo ''
done
