object Main {
  def main(args: Array[String]) {
    var datas        = Array[Int](0)
    var factors_list = Array[String]()
    var count        = 0
    for (line <- io.Source.stdin.getLines()) {
      if (count == 0) {
        datas = line.split(" ").map{_.toInt}
      }
      else {
        if (!line.matches("""^\.+$""")) {
          factors_list = factors_list :+ line
        }
      }
      count += 1
    }

    var road_only = Array[Int]()
    for(i <- 0 until factors_list(0).length) {
      var check = true

      for(j <- 0 until factors_list.length) {
        if(factors_list(j)(i) == '#') {
          check = false
        }
      }

      if(check) {
        road_only = road_only :+ i
      }
    }


    for(i <- 0 until factors_list.length) {
      for(j <- 0 until factors_list(0).length) {
        if (!road_only.contains(j)) {
          print(factors_list(i)(j))
        }
      }
      println()
    }

  }
}
