jiahuimbzuai/CoQuIR huggingface dataset:
//  [javascript]
function Main(input) {
    const arr = [
  '1',                  '3',                  '4',
  '7',                  '11',                 '18',
  '29',                 '47',                 '76',
  '123',                '199',                '322',
  '521',                '843',                '1364',
  '2207',               '3571',               '5778',
  '9349',               '15127',              '24476',
  '39603',              '64079',              '103682',
  '167761',             '271443',             '439204',
  '710647',             '1149851',            '1860498',
  '3010349',            '4870847',            '7881196',
  '12752043',           '20633239',           '33385282',
  '54018521',           '87403803',           '141422324',
  '228826127',          '370248451',          '599074578',
  '969323029',          '1568397607',         '2537720636',
  '4106118243',         '6643838879',         '10749957122',
  '17393796001',        '28143753123',        '45537549124',
  '73681302247',        '119218851371',       '192900153618',
  '312119004989',       '505019158607',       '817138163596',
  '1322157322203',      '2139295485799',      '3461452808002',
  '5600748293801',      '9062201101803',      '14662949395604',
  '23725150497407',     '38388099893011',     '62113250390418',
  '100501350283429',    '162614600673847',    '263115950957276',
  '425730551631123',    '688846502588399',    '1114577054219522',
  '1803423556807921',   '2918000611027443',   '4721424167835364',
  '7639424778862807',   '12360848946698171',  '20000273725560978',
  '32361122672259149',  '52361396397820127',  '84722519070079276',
  '137083915467899403', '221806434537978679', '358890350005878082',
  '580696784543856761', '939587134549734843'
]
console.log(arr[input-1]);
}Main(require("fs").readFileSync("/dev/stdin","utf8").trim());
//  [javascript]
function main(input) {
  input=input.trim();
  const n = parseInt(input.split(" ")[0], 10);
  if(n==1){
    console.log(2);
  }else if(n==2){
    console.log(1);
  }else{
    var deff=[2,1]
    for(var i=2; i<=n; i++){
      deff.push(deff[i-1]+deff[i-2])
    }
    console.log(deff[n]);
  }

}



main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
"use strict";
    
const main = arg => {
    const N = arg.split("\n")[0];
    console.log(lucasMaster(N));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

function lucasMaster(n) {
  let answer = [2,1];
  for ( let i = 2; i <= n; i++) {
    answer.push(answer[i-2]+ answer[i-1]);
  }
  return answer.pop();
}
//  [javascript]
'use strict'

const luca = (num) => {
    let sum = []
    for(let i = 0; i <= num; i++){
        if(i === 0){
            sum.push(2)
        }else if(i === 1){
            sum.push(1)
        }else{
            sum.push(sum[i-1] + sum[i-2])
        }
    }
    return sum[num]
}


const main = (input) => {
    const N = parseInt(input)
    console.log(luca(N))
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))
//  [go]
package main

import (
        "fmt"
)

func solution(n int) int {
        var L [87]int
        L[0] = 2
        L[1] = 1
        for i := 2; i <= n; i++ {
                L[i] = L[i-1] + L[i-2]
        }
        return L[n]
}

func main() {
        var n int
        fmt.Scan(&n)
        fmt.Println(solution(n))
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	if x == 2 {
		return true
	}
	if x%2 == 0 {
		return false
	}

	b := true
	rootx := int(math.Sqrt(float64(x)))
	i := 3
	for i <= rootx {
		if x%i == 0 {
			b = false
			break
		}
		i += 2
	}
	return b
}

func PrimeFactors(n int) (pfs []int) {
	// Get the number of 2s that divide n
	for n%2 == 0 {
		pfs = append(pfs, 2)
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			pfs = append(pfs, i)
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs = append(pfs, n)
	}

	return
}

//Main
const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		return sc
	}()
)

var N int

func solution(j, k, i, N int) int {
	if i == N-1 {
		return j + k
	}
	return solution(k, j+k, i+1, N)
}

func main() {
	sc.Split(bufio.ScanWords)

	N = nextInt() - 1
	if N == 0 {
		fmt.Println(1)
		return
	}
	fmt.Println(solution(2, 1, 0, N))

}
//  [go]
package main

import (
        "fmt"
)

func solution(n int) int {

        memo := make(map[int]int, 86)
        var rec func(n int) int

        rec = func(n int) int {
                if n == 0 {
                        return 2
                }

                if n == 1 {
                        return 1
                }
                out, ok := memo[n]
                if !ok {
                        out = rec(n-1) + rec(n-2)
                        memo[n] = out
                }
                return out
        }
        return rec(n)
}

func main() {
        var n int
        fmt.Scan(&n)
        fmt.Println(solution(n))
}
//  [go]
package main

import "fmt"

func main() {
	// Code for B - Lucas Number
	var N int
	fmt.Scanf("%d", &N)
	var L0 int = 2
	var L1 int = 1
	var L2 int = 0

	for i := 2; i <= N; i++ {
		L2 = L1 + L0
		L0 = L1
		L1 = L2
	}

	fmt.Println(L2)
}
//  [go]
package main

import "fmt"

func main() {
	// Code for B - Lucas Number
	var N int
	fmt.Scanf("%d", &N)
	var L0 int = 2
	var L1 int = 1
	var L2 int

	for i := 1; i < N; i++ {
		L2 = L1 + L0
		L0 = L1
		L1 = L2
	}

	fmt.Println(L2)
}
//  [ruby]
N=gets.to_i

l = [2,1]
(N-1).times do
    l = [l[1],l[0]+l[1]]
end

puts l[1]
//  [ruby]
$memo = [-1] * 100
def lucas n
  return 2 if n == 0
  return 1 if n == 1
  $memo[n] = lucas(n-1) + lucas(n-2) if $memo[n] == -1
  return $memo[n]
end
puts lucas(gets.to_i)
//  [ruby]
N = gets.to_i
L = Hash.new do |h, i|
    h[i] = h[i-1] + h[i-2]
end
L[0] = 2
L[1] = 1
puts L[N]
//  [ruby]
n = gets.chomp.to_i
a = 2
b = 1
ans = 0
if n >= 2
(n-1).times do |i|
    ans = b + a
    a = b
    b = ans
end
else
    puts "1"
end
puts ans
//  [ruby]
n = gets.chomp.to_i
a = 2
b = 1
ans = 0
(n-1).times do |i|
    ans = b + a
    a = b
    b = ans
end
puts ans
//  [ruby]
n = gets.to_i
def l(n)
  if n==0
    return 2
  elsif n==1
    return 1
  else
    return l(n-1)+l(n-2)
  end
end

puts l(n)
//  [rust]
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<u64> = procon_read();
	let n = v[0];
	let mut L0:u64 = 2;
	let mut L1:u64 = 1;
	let mut ret:u64 = 1;
	for i in 0..(n-1) {
		ret = L1 +L0;
		L0 = L1;
		L1 = ret;
	}
	println!("{}", ret);
}
//  [rust]
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let n = read_as_vec::<usize>()[0];

    let mut v: Vec<u64> = vec![0;n+1];
    v[0] = 2;
    v[1] = 1;
    for i in 2..n+1{
        v[i] = v[i-1] + v[i-2];
    }

    println!("{}", v[n]);
}
//  [rust]
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let n: usize = read!();
    let mut l = vec![0; n + 1];
    l[0]=2;
    l[1]=1;
    for i in 2..=n{
        l[i] = l[i - 1] + l[i - 2];
    }
    
    println!("{}", l[n]);
}
//  [rust]
use proconio::{input, fastout};
use std::process;

#[fastout]
fn main() {
    input!{
        n: usize,
    }
    let mut ret: u64 = 0;
    let mut prev: u64 = 2;
    let mut curr: u64 = 1;
    if n == 1 {
	println!("1");
	process::exit(0);
    }
    for i in 2..(n+1) {
	ret = prev + curr;
	prev = curr;
	curr = ret;
    }
    println!("{}", ret);
}
//  [rust]
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<u64> = procon_read();
	let n = v[0];
	let mut L0:u64 = 2;
	let mut L1:u64 = 1;
	let mut ret:u64 = 0;
	for i in 0..(n-1) {
		ret = L1 +L0;
		L0 = L1;
		L1 = ret;
	}
	println!("{}", ret);
}
//  [swift]
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/

//var min, min2, count: Int!
//for i in 1...10 {
//    let x = Int(readLine()!)!
//    if i == 1 {
//        min = x
//        count = 1
//    } else if x < min {
//        min2 = min
//        min = x
//        count = 1
//    } else if x == min && count == 1 {
//        min2 = x
//        count = 2
//    }
//}
//print(min2)

/*************** メインプログラム ***************/

let N = readInt()!
var L = [2, 1]
for i in 2...86 {
    L += [L[i-1] + L[i-2]]
}
print(L[N])
//  [swift]
let n = Int(readLine()!)!
var count = 1, l = 2, tmp = 0, ans = 1
while count < n {
  tmp = ans
  ans = l + ans
  l = tmp
  count += 1
}
print(ans)
//  [swift]
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/

//var min, min2, count: Int!
//for i in 1...10 {
//    let x = Int(readLine()!)!
//    if i == 1 {
//        min = x
//        count = 1
//    } else if x < min {
//        min2 = min
//        min = x
//        count = 1
//    } else if x == min && count == 1 {
//        min2 = x
//        count = 2
//    }
//}
//print(min2)

/*************** メインプログラム ***************/

let N = readInt()!
var L = [2, 1]
for i in 2...N {
    L += [L[i-1] + L[i-2]]
}
print(L[N])
//  [swift]
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/

//var min, min2, count: Int!
//for i in 1...10 {
//    let x = Int(readLine()!)!
//    if i == 1 {
//        min = x
//        count = 1
//    } else if x < min {
//        min2 = min
//        min = x
//        count = 1
//    } else if x == min && count == 1 {
//        min2 = x
//        count = 2
//    }
//}
//print(min2)

/*************** メインプログラム ***************/

let N = readInt()!
var L = [2, 1]
for i in 2..<N {
    L += [L[i-1] + L[i-2]]
}
print(L[N-1])
//  [swift]
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/

//var min, min2, count: Int!
//for i in 1...10 {
//    let x = Int(readLine()!)!
//    if i == 1 {
//        min = x
//        count = 1
//    } else if x < min {
//        min2 = min
//        min = x
//        count = 1
//    } else if x == min && count == 1 {
//        min2 = x
//        count = 2
//    }
//}
//print(min2)

/*************** メインプログラム ***************/

let N = readInt()!
var L = [2, 1]
for i in 2..<N {
    L[i] = L[i-1] + L[i-2]
}
print(L[N-1])
//  [typescript]
"use strict";
    
const main = arg => {
    const N = parseInt(arg.split("\n")[0]);
	
    // 一部 JavaScript の扱える整数最大値を超えるので応急処置
    if (N === 77) {console.log("12360848946698171"); return;}
    if (N === 78) {console.log("20000273725560978"); return;}
    if (N === 79) {console.log("32361122672259149"); return;}
    if (N === 80) {console.log("52361396397820127"); return;}
    if (N === 81) {console.log("84722519070079276"); return;}
    if (N === 82) {console.log("137083915467899403"); return;}
    if (N === 83) {console.log("221806434537978679"); return;}
    if (N === 84) {console.log("358890350005878082"); return;}
    if (N === 85) {console.log("580696784543856761"); return;}
    if (N === 86) {console.log("939587134549734843"); return;}

    console.log(lucasMaster(N));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

function lucasMaster(n) {
  let answer = [2, 1];
  for ( let i = 2; i <= n; i++) {
    answer.push(answer[i-2] + answer[i-1]);
  }
  return answer.pop();
}
//  [typescript]
import * as fs from "fs";

const input = fs.readFileSync("/dev/stdin", "utf8");
const N = +input;

const L: BigInt[] = Array(N + 1);

if (N === 1) {
  L[N] = BigInt(1);
} else {
  L[0] = BigInt(2);
  L[1] = BigInt(1);

  for (let i = 2; i <= N; i++) {
    L[i] = BigInt(L[i - 1]) + BigInt(L[i - 2]);
  }
}

console.log(String(L[N]));
//  [typescript]
import * as fs from "fs";

const input = fs.readFileSync("/dev/stdin", "utf8");
const N = +input;

const L: number[] = Array(N + 1);

if (N === 1) {
  L[N] = 1;
} else {
  L[0] = 2;
  L[1] = 1;

  for (let i = 2; i <= N; i++) {
    L[i] = L[i - 1] + L[i - 2];
  }
}

console.log(L[N]);
//  [typescript]
import * as fs from "fs";

const input = fs.readFileSync("/dev/stdin", "utf8");
const a = +input;

console.log(lucasNumber(a));

function lucasNumber(n: number): number {
  if (n === 0) {
    return 2;
  } else if (n === 1) {
    return 1;
  } else {
    return lucasNumber(n - 1) + lucasNumber(n - 2);
  }
}
//  [typescript]
import * as readline from "readline";

/* ここに処理を書く */
const main = (args: any[]) => {
  const N = args[0];
  const L0 = 2,
    L1 = 1;

  switch (N) {
    case 0:
      console.log(L0);
      break;
    case 1:
      console.log(L1);
      break;
    default:
      let l1 = L1,
        l2 = L0;
      let li;
      for (let i = 2; i <= N; i++) {
        li = l1 + l2;
        l2 = l1;
        l1 = li;
      }
      console.log(li);
  }
  return;
};

/* 標準入力処理 */
const stdin = (main: Function) => {
  const args: any[] = [];
  const reader = readline.createInterface({
    input: process.stdin,
    output: process.stdout
  });
  reader.on("close", function() {
    main(args);
  });
  reader.on("line", function(line: any) {
    if (line === "") {
      reader.close();
    }
    line.split(" ").forEach((arg: any) => {
      args.push(isNaN(arg) ? arg : Number(arg));
    });
  });
};
/* 実行 */
stdin(main);
//  [python]
h, w = map(int, input().split())
a = ''.join([input() for _ in range(h)])
c = ''
b = ''

for i in range(h):
    s = a[i*w:-~i*w]
    if s != '.' * w:
        b += s

nh = len(b) // w
for j in range(w):
    s = b[j::w]
    if s != '.' * nh:
        c += s

nw = len(c) // nh
for i in range(nh):
    print(c[i::nh])
//  [python]
h,w=map(int,input().split())
a=[list(input()) for i in range(h)]
b=[x for x in a if "#" in x]
c=zip(*[y for y in zip(*b) if "#" in y])
for d in c:
    print("".join(d))
//  [python]
h, w = map(int, input().split())
# print(h, w)

# matrix = []
# for _ in range(h):
#     row = input()
#     if '#' not in row:
#         continue
#     else:
#         matrix.append(row)

# print(matrix)

matrix = [input() for _ in range(h)]
# print(matrix)
matrix = [row for row in matrix if '#' in row]
# print(matrix)

T_matrix = [col for col in zip(*matrix) if '#' in col]
# print(T_matrix)

# T_matrix = []

# for col in zip(*matrix):
#     if '#' not in col:
#         continue
#     else:
#         T_matrix.append(col)

# for row in matrix:
#     print(row)
# for row in zip(*T_matrix):
#     print(''.join(row))

print(*(''.join(row) for row in zip(*T_matrix)), sep='\n')
//  [python]
h, w = (int(i) for i in input().split())
list_a = [input() for s in range(0, w)]
list_tmp = []
for i in range(0, w):
    for j in range(0, h):
        if list_a[i][j] == '#':
            list_tmp.append(list(list_a[i]))
            break
# 転置... https://note.nkmk.me/python-list-transpose/　参照
list_tmp_t = [list(x) for x in zip(*list_tmp)]
list_tmp2 = []
for i in range(0, h):
    for j in range(0, len(list_tmp_t[i])):
        if list_tmp_t[i][j] == '#':
            list_tmp2.append(list(list_tmp_t[i]))
            break
# 転置... https://note.nkmk.me/python-list-transpose/　参照
list_ans = [list(x) for x in zip(*list_tmp2)]
for i in range(0, len(list_ans)):
    print("".join(list_ans[i]))
//  [python]
h,w=map(int,input().split())
A=[list(input()) for i in range(w)]
answ=[]
ansh=[]
for i in range(w):
  if not all([a=="." for a in A[i]]):
    answ.append(i)
for j in range(h):
  if not all([A[i][j]=="." for i in range(w)]):
    ansh.append(j)
for i in answ:
  for j in ansh:
    print(A[i][j],end="")
  print("\n")
//  [python]
h, w = map(int,input().split())

A = [list(input()) for _ in range(h)]

row = [False] * h
col = [False] * w

for i in range(h):
    for j in range(w):
        if A[i][j] == '#':
            row[i] = True
            col[j] = True

for i in range(h):
    if row[i]:
        for j in range(w):
            if col[j]:
                print(A[i][j], end = '')
//  [java]
import java.io.*;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    String[] line1 = br.readLine().split(" ");
    int h = Integer.parseInt(line1[0]);
    int w = Integer.parseInt(line1[1]);
    
    char[][] c = new char[h][w];
    boolean[] viewLine = new boolean[h];
    boolean[] viewColumn = new boolean[w];
    
    for(int i=0; i<h; i++){
      c[i] = br.readLine().toCharArray();
    }
    for (int i=0; i<h; i++){
      for (int j=0; j<w; j++){
        if(c[i][j] == '#'){
          viewLine[i] = true;
          viewColumn[j] = true;
        }
      }
    }
    StringBuilder result =  new StringBuilder();
    for (int i=0; i<h; i++){
      if (!viewLine[i]) continue;
      for (int j=0; j<w; j++){
        if (viewColumn[j]) {
          result.append(c[i][j]);
        }
      }
      result.append("\n");
    }
    System.out.println(result.toString());
  }
}
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer tok = new StringTokenizer(br.readLine());
        final byte h = Byte.parseByte(tok.nextToken());
        final byte w = Byte.parseByte(tok.nextToken());

        char[][] mat = new char[h][w];
        boolean[] row = new boolean[h];
        boolean[] col = new boolean[w];

        for (byte i = 0; i < h; i++) {
            String str = br.readLine();
            for (byte j = 0; j < w; j++) {
                char c = str.charAt(j);
                mat[i][j] = c;
                if (c == '#') {
                    row[i] = true;
                    col[j] = true;
                }
            }
        }

        PrintWriter out = new PrintWriter(System.out);
        for (byte i = 0; i < h; i++) {
            if (!row[i]) continue;
            for (byte j = 0; j < w; j++) {
                if (col[j]) {
                    out.print(mat[i][j]);
                }
            }
            out.print("\n");
        }
        out.flush();
    }
}
//  [java]
import java.util.*;


public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int h = sc.nextInt();
        int w = sc.nextInt();
        char[][] c = new char[h][w];
        int acount=0;
        
        for(int i=0; i<h; i++){
            String  s = sc.next();
            for(int j=0; j<w; j++){
                c[i][j] = s.charAt(j);
            }
        }
        
        for(int i=0; i<h; i++){
            int flg = 0;
            for(int j=0; j<w; j++){
                if(c[i][j]=='#'){
                    flg = 1;
                }
            }
            if(flg == 0){
                for(int j=0; j<w; j++){
                    c[i][j]='0';
                }
            }else{
                acount++;
            }
        }
        
        for(int j=0; j<w; j++){
            int flg = 0;
            for(int i=0; i<h; i++){
                if(c[i][j]=='#'){
                    flg = 1;
                }
            }
            if(flg == 0){
                for(int i=0; i<h; i++){
                    c[i][j]='0';
                }
            }
        }
        
        for(int i=0; i<h; i++){
            int a=0;
            for(int j=0; j<w; j++){
                if(c[i][j]!='0'){
                    System.out.print(c[i][j]);
                    a++;
                }
            }
            if(a==acount){
                System.out.println();
            }
            //System.out.println(a);
        }
    }
}
//  [java]
import java.util.*;


public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int h = sc.nextInt();
        int w = sc.nextInt();
        char[][] c = new char[h][w];
        int icount=h;
        
        for(int i=0; i<h; i++){
            String  s = sc.next();
            for(int j=0; j<w; j++){
                c[i][j] = s.charAt(j);
            }
        }
        
        for(int i=0; i<h; i++){
            int flg = 0;
            for(int j=0; j<w; j++){
                if(c[i][j]=='#'){
                    flg = 1;
                }
            }
            if(flg == 0){
                icount--;
                for(int j=0; j<w; j++){
                    c[i][j]='0';
                }
            }
        }
        
        for(int j=0; j<w; j++){
            int flg = 0;
            for(int i=0; i<h; i++){
                if(c[i][j]=='#'){
                    flg = 1;
                }
            }
            if(flg == 0){
                for(int i=0; i<h; i++){
                    c[i][j]='0';
                }
            }
        }
        
        for(int i=0; i<h; i++){
            for(int j=0; j<w; j++){
                if(c[i][j]!='0'){
                    System.out.print(c[i][j]);
                    if(j==icount-1){
                        System.out.println();
                    }
                }
            }
            
        }
    }
}
//  [java]
import java.util.*;


public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int h = sc.nextInt();
        int w = sc.nextInt();
        char[][] c = new char[h][w];
        
        for(int i=0; i<h; i++){
            String  s = sc.next();
            for(int j=0; j<w; j++){
                c[i][j] = s.charAt(j);
            }
        }
        
        for(int i=0; i<h; i++){
            int flg = 0;
            for(int j=0; j<w; j++){
                if(c[i][j]=='#'){
                    flg = 1;
                }
            }
            if(flg == 0){
                for(int j=0; j<w; j++){
                    c[i][j]='0';
                }
            }
        }
        
        for(int j=0; j<w; j++){
            int flg = 0;
            for(int i=0; i<h; i++){
                if(c[i][j]=='#'){
                    flg = 1;
                }
            }
            if(flg == 0){
                for(int i=0; i<h; i++){
                    c[i][j]='0';
                }
            }
        }
        
        for(int i=0; i<h; i++){
            for(int j=0; j<w; j++){
                if(c[i][j]!='0'){
                    System.out.print(c[i][j]);
                    if(j==w-1){
                        System.out.println();
                    }
                }
            }
            
        }
    }
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
int n, m;
string mat[110];
bool f[110], c[110];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    for(int i = 0; i < n; i ++)
        cin >> mat[i];
    for(int i = 0; i < n; i ++)
    {
        bool flag = true;
        for(int j = 0; j < m; j ++)
            if(mat[i][j] == '#')
            {
                flag = false;
                break;
            }
        f[i] = flag;
    }
    for(int j = 0; j < m; j ++)
    {
        bool flag = true;
        for(int i = 0; i < n; i ++)
            if(mat[i][j] == '#')
            {
                flag = false;
                break;
            }
        c[j] = flag;
    }
    for(int i = 0; i < n; i ++)
    {
        if(f[i])
            continue;
        for(int j = 0; j < m; j ++)
            if(!c[j])
                cout << mat[i][j];
        cout << '\n';
    }
    return 0;
}
//  [cpp]
#include<cstdio>
#include<algorithm>
using namespace std;const int N=110;bool book1[N];bool book2[N];
char mde[N][N];int n;int m;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)scanf("%s",mde[i]+1);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)book1[i]|=(mde[i][j]=='#'),book2[j]|=(mde[i][j]=='#');
	for(int i=1;i<=n;i++)
		{
			if(book1[i]==false)continue;
			for(int j=1;j<=m;j++)if(book2[j])printf("%c",mde[i][j]);printf("\n");
		}return 0;
	
}
//  [cpp]
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int h,w;
  cin >> h>>w;
  vector<string> a;
  for (int i = 0; i < h; ++i) {
    string s;
    cin >> s;
    if (find(s.begin(), s.end(), '#') != s.end()) {
      a.push_back(s);
    }
  }
  vector<int> crash(w, 0);
  for (auto& e : a) {
    for (int i = 0; i < w; ++i) {
      crash[i] |= e[i] == '#';
    }
  }

  for (auto& e : a) {
    string row;
    for (size_t i = 0; i < e.size(); ++i) {
      if (crash[i] != 0) {
        row.push_back(e[i]);
      }
    }
    cout << row << "\n";
  }
}
//  [cpp]
#include <iostream>
#include <vector>
using namespace std;

void transform_columns( vector<vector<char> > & arr )
{
	int is_white;
	for(int i = 0; i < (int)arr[i].size(); i++)
	{
		is_white = 0;
		for(int j = 0; j < (int)arr.size(); j++)
			if( arr[j][i] == '.' or arr[j][i] == 'X' )
				is_white++;
		if( is_white == (int)arr.size() )
			for(int j = 0; j < (int)arr.size(); j++)
				arr[j][i] = 'X';
	}
}

void transform_rows( vector<vector<char> > & arr )
{
	int is_white;
	for(int i = 0; i < (int)arr.size(); i++)
	{
		is_white = 0;
		for(int j = 0; j < (int)arr[i].size(); j++)
			if( arr[i][j] == '.' or arr[i][j] == 'X' )
				is_white++;
		if( is_white == (int)arr[i].size() )
			for(int j = 0; j < (int)arr[i].size(); j++)
				arr[i][j] = 'X';
	}
}

void show_matrix( vector<vector<char> > & arr )
{
	int is_x;
	for(int i = 0 ; i < (int)arr.size(); i++)
	{
		is_x = 0;
		for(int j = 0; j < (int)arr[i].size(); j++)
		{
			if( arr[i][j] == 'X' )
				is_x++;
			else cout << arr[i][j];
		}
		
		if( is_x != (int)arr[i].size() )
			cout << "\n";
	}
}

int main()
{
	int h, w;
	cin >> h >> w;
	vector< vector <char> > arr;
	for(int i = 0; i < h; i++)
	{
		vector <char> tmp(w);
		for(int j = 0; j < w; j++)
			cin >> tmp[j];
		arr.push_back(tmp);
	}
	transform_rows(arr);
	transform_columns(arr);
	show_matrix(arr);
}
//  [cpp]
#include <iostream>
#include <vector>
using namespace std;

void transform_columns( vector<vector<char> > & arr )
{
	int is_white;
	for(int i = 0; i < (int)arr[i].size(); i++)
	{
		is_white = 0;
		for(int j = 0; j < (int)arr.size(); j++)
			if( arr[j][i] == '.' or arr[j][i] == 'X' )
				is_white++;
		if( is_white == (int)arr.size() )
			for(int j = 0; j < (int)arr.size(); j++)
				arr[j][i] = 'X';
	}
}

void transform_rows( vector<vector<char> > & arr )
{
	int is_white;
	for(int i = 0; i < (int)arr.size(); i++)
	{
		is_white = 0;
		for(int j = 0; j < (int)arr[i].size(); j++)
			if( arr[i][j] == '.' or arr[i][j] == 'X' )
				is_white++;
		if( is_white == (int)arr[i].size() )
			for(int j = 0; j < (int)arr[i].size(); j++)
				arr[i][j] = 'X';
	}
}

void show_matrix( vector<vector<char> > & arr )
{
	int is_x;
	for(int i = 0 ; i < (int)arr.size(); i++)
	{
		is_x = 0;
		for(int j = 0; j < (int)arr[i].size(); j++)
		{
			if( arr[i][j] == 'X' )
				is_x++;
			else cout << arr[i][j];
		}
		
		if( is_x != (int)arr[i].size() )
			cout << "\n";
	}
}

int main()
{
	int h, w, is_white;
	cin >> h >> w;
	vector< vector <char> > arr;
	for(int i = 0; i < h; i++)
	{
		vector <char> tmp(w);
		for(int j = 0; j < w; j++)
			cin >> tmp[j];
		arr.push_back(tmp);
	}
	transform_rows(arr);
	transform_columns(arr);
	show_matrix(arr);
}
//  [cpp]
#include <iostream>
#include <vector>
using namespace std;

void transform_columns( vector<vector<char> > & arr )
{
	int is_white;
	for(int i = 0; i < arr[i].size(); i++)
	{
		is_white = 0;
		for(int j = 0; j < arr.size(); j++)
			if( arr[j][i] == '.' or arr[j][i] == 'X' )
				is_white++;
		if( is_white == arr.size() )
			for(int j = 0; j < arr.size(); j++)
				arr[j][i] = 'X';
	}
}

void transform_rows( vector<vector<char> > & arr )
{
	int is_white;
	for(int i = 0; i < arr.size(); i++)
	{
		is_white = 0;
		for(int j = 0; j < arr[i].size(); j++)
			if( arr[i][j] == '.' or arr[i][j] == 'X' )
				is_white++;
		if( is_white == arr[i].size() )
			for(int j = 0; j < arr[i].size(); j++)
				arr[i][j] = 'X';
	}
}

void show_matrix( vector<vector<char> > & arr )
{
	int is_x;
	for(int i = 0 ; i < arr.size(); i++)
	{
		is_x = 0;
		for(int j = 0; j < arr[i].size(); j++)
		{
			if( arr[i][j] == 'X' )
				is_x++;
			else cout << arr[i][j];
		}
		
		if( is_x != arr[i].size() )
			cout << "\n";
	}
}

int main()
{
	int h, w, is_white;
	cin >> h >> w;
	vector< vector <char> > arr;
	for(int i = 0; i < h; i++)
	{
		vector <char> tmp(w);
		for(int j = 0; j < w; j++)
			cin >> tmp[j];
		arr.push_back(tmp);
	}
	transform_rows(arr);
	transform_columns(arr);
	show_matrix(arr);
}
//  [c]
/*  ex5_3
    takafumi_ueki*/
#include <stdio.h>
    int main(void){
        int i,j,length,width;
        int row[100]={0};
        int col[100]={0};
        char field[100][100];
        //縦と横の長さを受け取る
        scanf("%d %d",&length,&width);
        //マス目が'.'か'#'かを受け取る
        for(i=0;i<length;i++){
            for(j=0;j<width;j++){
                scanf(" %c",&field[i][j]);
            }
        }
        //列ごとに'#'が含まれているかどうかを調べる
        //もし含まれていたらrow[i]が1になる
        for(i=0;i<length;i++){
            for(j=0;j<width;j++){
                if(field[i][j]=='#'){
                    row[i]=1;
                    break;
                }
            }
        }
        //次に行ごとに'#'が含まれていないか調べる
        for(j=0;j<width;j++){
            for(i=0;i<length;i++){
                if(field[i][j]=='#'){
                    col[j]=1;
                    break;
                }
            }
        }
        //もし,'#'がひとつでも含まれていたらその行、列は書き出すようにする
        for(i=0;i<length;i++){
            for(j=0;j<width;j++){
                if(row[i]==1&&col[j]==1){
                    printf("%c",field[i][j]);
                }
            }
            printf("\n");
        }
        return 0;
    }
//  [c]
/*  ex5_3
    Graku   */
#include<stdio.h>

int main(void) {
    int height, width;
    scanf("%d %d", &height, &width);
    int blank_rows[height], blank_cols[width]; //blank -> 0, not blank -> 1
    char matrix[height][width];
    for (int row = 0; row < height; ++row) {
        for (int col = 0; col < width; ++col) {
            scanf(" %c", &matrix[row][col]); //don't read "\n"
        }
    }

    for (int row = 0; row < height; ++row) { //find blank rows
        int flag = 0;
        for (int col = 0; col < width; ++col) {
            if ('#' == matrix[row][col]) { //not blank
                flag = 1;
                break;
            }
        }
        blank_rows[row] = flag;
    }
    for (int col = 0; col < width; ++col) { //find blank columns
        int flag = 0;
        for (int row = 0; row < height; ++row) {
            if ('#' == matrix[row][col]) { //not blank
                flag = 1;
                break;
            }
        }
        blank_cols[col] = flag;
    }

    for (int row = 0; row < height; row++) {
        if (blank_rows[row]) { //if row is not blank
            for (int col = 0; col < width; ++col) {
                if (blank_cols[col]) { //if column is not blank
                    printf("%c", matrix[row][col]);
                }
            }
            printf("\n");
        }
    }

    return 0;
}
//  [c]
/* kadai5_3
   reo012 */


#include<stdio.h>

int main(void){
    int h, w, i, j;
    scanf("%d %d", &h, &w); //行数hと列数wの入力
    int row[h], col[w];  //h行目またはw列目に黒マスがあるかの情報を入れる配列
    char squares[h][w];  //h行w列の二次元配列squaresを定義

    //始めに配列row,colは全て0を入力
    for(i=0;i < h;i++){
        row[i] = 0;
    }
    for(j=0;j < w;j++){
        col[j] = 0;
    }

    //二次元配列squareに行ごとに入力
    for(i=0;i < h;i++){
        for(j=0;j < w;j++){
            scanf(" %c",&squares[i][j]);  //i行目j列目入力
            //黒が入力された場合その行と列の配列に１を入れる
            if(squares[i][j] == '#'){
                row[i] = 1;
                col[j] = 1;
            }
        }
    }

    //白い行、白い列を省いて出力していく。row[i]=1かつcol[j]=1のマスのみ出力
    for(i=0;i < h;i++){
        //行に黒が含まれる場合のみ表示する
        if(row[i] == 1){
            for(j=0;j < w;j++){
                //列に黒が含まれる場合のみ表示する
                if(col[j] == 1){
                    printf("%c",squares[i][j]);
                }
            }
            printf("\n");//行を出力したら改行
        }
    }

    return 0;
}
//  [c]
/*
    ex7_3
    takaoga
 */

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

void delete_whiteline(char **board, int *hight, int *width);

int main(void){
    int i, width, hight;
    char **board;
    scanf("%d %d\n",&hight ,&width);
    board = (char**)calloc(hight, sizeof(char*));
    if(board == NULL){
        exit(1);
    }
    for(i = 0;i < hight; i++){
        board[i] = (char*)calloc(width, sizeof(char));
        if(board[i] == NULL){
            exit(1);
        }
    }
    for(i = 0;i < hight ; i++){
        scanf("%s", board[i]);
    }
    delete_whiteline(board, &hight, &width);
    for(i = 0; i < hight ; i++){
        board[i][width] = 0;
        printf("%s\n", board[i]);
    }
    for(i = 0; i < hight ; i++){
        free(board[i]);
    }
    free(board);

    return 0;
}

void delete_whiteline(char **board,int *hight,int *width){
    int i, j,k, counter_row, counter_column;
    for(i = 0 ; i < *hight ; i++){
        counter_row = 0;
        for(j = 0 ; j < *width ; j++){
            if(board[i][j] == '.') counter_row++;//行を調べて、白だけの物がないかチェック
        }
        if(counter_row == *width){
            free(board[i]);
            *hight = *hight - 1;
            for(k = i ; k < *hight ; k++){
                board[k] = board[k+1];//白だけの行があったらその行を消す
            }
        }
    }
    
    for(i = 0 ; i < *width ; i++){
        counter_column = 0;
        for(j = 0 ; j < *hight ; j++){
            if(board[j][i] == '.') counter_column++;//列を調べて、白だけの物がないかチェック
        }
        if(counter_column == *hight){
            *width = *width - 1;
            for(k = i ; k < *width ; k++){
                for(j = 0 ; j < *hight ; j++){
                    board[j][k] = board[j][k+1];//白だけの列があったらその行を消す
                }
                for(j = 0 ; j < *hight ; j++){
                    board[j] = (char *)realloc(board[j], *width);//最後にreallocする
                }
                
            }

        }
    }   
}
//  [c]
#include <stdio.h>
#define LIMIT 100
​
int main(void){
    int row,col,i,j,rowjudge[LIMIT]={0},coljudge[LIMIT]={0};
    char matrix[LIMIT][LIMIT];
    scanf("%d %d",&row,&col);
​
    // 初期化
    for(i=0; i<LIMIT; i++){
        for(j=0; j<LIMIT; j++){
            matrix[i][j]='\0';
        }
    }
​
    // 入力
    for(i=0; i<row; i++){
        for(j=0; j<col; j++){
            scanf(" %c",&matrix[i][j]);
        }
    }
​
    // 各行、各列に黒が１つでもあるかを判別
    for(i=0; i<row; i++){
        for(j=0; j<col; j++){
            if(matrix[i][j]=='#'){
                rowjudge[i]=1;
            }
        }
    }
    for(j=0; j<col; j++){
        for(i=0; i<row; i++){
            if(matrix[i][j]=='#'){
                coljudge[j]=1;
            }
        }
    }
​
    // 黒が１つでもある行と列の重なる要素のみを出力
    for(i=0; i<row; i++){
        for(j=0; j<col; j++){
            if(rowjudge[i]==1 && coljudge[j]==1){
                printf("%c",matrix[i][j]);
            }
        }
        if(rowjudge[i]==1){
            printf("\n");
        }
    }
    return 0;
}
//  [javascript]
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim();}
function myout(t){console.log(t);}//standard output
function myerr(t){console.error(t);}//standard error
//[no]param
//0:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
function myconv(i,no){switch(no){case 0:return i;case 1:return parseInt(i);case 2:return i.split(" ");case 3:return i.split("\n");case 4:return i.split(" ").map((a)=>Number(a));case 5:return i.split("\n").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));}}
function Main(input) {
  input = myconv(input,3);
  var H = myconv(input[0],4)[0];
  var W = myconv(input[0],4)[1];
  input.shift();
  for(var i = 0; i < H; i++){
    if(input[i].indexOf("#") == -1){
       input.splice(i,1);
      H--;
      i--;
    }
  }
  var checkWidth = new Array(W).fill(0);
  for(var i = 0; i < H; i++){
    var tmp = myconv(input[i],6);
    for(var j = 0; j < W; j++){
      if(tmp[j] == "."){
         checkWidth[j]++;
      }
    }
  }
  for(var i = 0; i < H; i++){
    var tmp = myconv(input[i],6);
    for(var j = 0; j < W; j++){
      if(checkWidth[j] == H){
         tmp[j] = "";
      }
    }
    input[i] = tmp.join("");
  }
  myout(input.join("\n"));
}
Main(myin());
//  [javascript]
function Main(input){
	input = input.split("\n");
  var HW = input.shift().split(" ");
  
  var h = Array.from({length:HW[0]},()=>0);
  var w = Array.from({length:HW[1]},()=>0);
  
  for(var i = 0 ; i < HW[0] ; i++){
  	for(var j = 0; j < HW[1] ; j++){
    	if(input[i][j] == "#")h[i] = w[j] = 1;
    }
  }
  
  var result = "";
  
  for(var i = 0 ; i < HW[0] ; i++){
    var aaaaa = 0;
  	for(var j = 0; j < HW[1] ; j++){
    	if(h[i]*w[j]){
      	result += input[i][j];
        aaaaa++;
      }
    }
    if(aaaaa != 0 && i != HW[0]-1)result += "\n";
  }
  
  return result;
}

// If you are interested in the algorithms I used, 
// there is no need to read down from this line.

((b,c,d)=>"undefined"!=typeof require?console.log(Main(require("fs").readFileSync("/dev/stdin","utf8"))):[b=b.split("\n").slice(1,-1).join("\n"),c=function(){try{return Main(b)}catch(f){return f.stack||f.message}}(),d=typeof c,"string"==d||(c=JSON.stringify(c)),$("<form>").append([[10,b],0,[1,d],0,[10,c]].map(f=>$(f?"<textarea>":"<br>",f&&{rows:f[0],cols:40,text:f[1]}))).appendTo("body")])(`
7 6
......
....#.
.#....
..#...
..#...
......
.#..#.
`);
//  [javascript]
"use strict"
// inputに入力データ全体が入る
function Main(input) {
    let tmp = input.split("\n");
    let num = tmp[0].split(" ").map(e=>~~e);
    let arr = tmp.slice(1, num[1]+1);
    for(let i = 0;i < arr.length-1;i++) arr[i] = arr[i].slice(0, -1);
    arr = arr.filter(w=>!w.split("").every(a=>a=="."));
    let newArr = arr.map(e=>e.split(""));
    const transpose = a => a[0].map((_, c) => a.map(r => r[c]));
    let hoge = transpose(newArr);
    hoge = hoge.filter(w=>!w.every(a=>a=="."));
    let fuga = transpose(hoge);
    console.log(fuga.join("\n").replace(/,/g, ''));
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("./input3.txt", "utf8"));
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
	const lines = str.split("\n");
	const arr1 = lines.filter(l => !l.split("").every(s => s === "."));
	const arr2 = arr1[0].split("").map((_, i) => arr1.map(l => l[i]));
	const arr3 = arr2.filter(l => !l.every(s => s === "."));
	const arr4 = arr3[0].map((_, i) => arr3.map(l => l[i]));
	console.log(arr4.map(l => l.join("")).join("\n"));
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));