public static void main ( String [ ] args ) {
  int h = sc . nextInt ( ) ;
  int w = sc . nextInt ( ) ;
  char [ ] [ ] map = new char [ h ] [ w ] ;
  for ( int i = 0 ;
  i < h ;
  i ++ ) map [ i ] = sc . next ( ) . toCharArray ( ) ;
  for ( int i = 0 ;
  i < h ;
  i ++ ) {
    boolean F = true ;
    for ( int j = 0 ;
    j < w ;
    j ++ ) {
      if ( map [ i ] [ j ] == '#' ) {
        F = false ;
        break ;
      }
    }
    if ( F == true ) {
      for ( int j = 0 ;
      j < w ;
      j ++ ) {
        map [ i ] [ j ] = 'x' ;
      }
    }
  }
  for ( int i = 0 ;
  i < w ;
  i ++ ) {
    boolean F = true ;
    for ( int j = 0 ;
    j < h ;
    j ++ ) {
      if ( map [ j ] [ i ] == '#' ) {
        F = false ;
        break ;
      }
    }
    if ( F == true ) {
      for ( int j = 0 ;
      j < h ;
      j ++ ) {
        map [ j ] [ i ] = 'x' ;
      }
    }
  }
  for ( int i = 0 ;
  i < h ;
  i ++ ) {
    StringBuilder sb = new StringBuilder ( "" ) ;
    boolean F = true ;
    for ( int j = 0 ;
    j < w ;
    j ++ ) {
      if ( map [ i ] [ j ] != 'x' ) sb . append ( map [ i ] [ j ] ) ;
    }
    if ( ! sb . toString ( ) . equals ( "" ) ) System . out . println ( sb ) ;
  }
}

public static void main ( String [ ] args ) { int h = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; char [ ] [ ] map = new char [ h ] [ w ] ; for ( int i = 0 ; i < h ; i ++ ) map [ i ] = sc . next ( ) . toCharArray ( ) ; for ( int i = 0 ; i < h ; i ++ ) { boolean F = true ; for ( int j = 0 ; j < w ; j ++ ) { if ( map [ i ] [ j ] == ' # ' ) { F = false ; break ; } } if ( F == true ) { for ( int j = 0 ; j < w ; j ++ ) { map [ i ] [ j ] = ' x ' ; } } } for ( int i = 0 ; i < w ; i ++ ) { boolean F = true ; for ( int j = 0 ; j < h ; j ++ ) { if ( map [ j ] [ i ] == ' # ' ) { F = false ; break ; } } if ( F == true ) { for ( int j = 0 ; j < h ; j ++ ) { map [ j ] [ i ] = ' x ' ; } } } for ( int i = 0 ; i < h ; i ++ ) { StringBuilder sb = new StringBuilder ( " " ) ; boolean F = true ; for ( int j = 0 ; j < w ; j ++ ) { if ( map [ i ] [ j ] != ' x ' ) sb . append ( map [ i ] [ j ] ) ; } if ( ! sb . toString ( ) . equals ( " " ) ) System . out . println ( sb ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier)) dimensions: (dimensions_expr (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (true))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (character_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (false))) (break_statement))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (true))) consequence: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (character_literal))))))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (true))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (character_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (false))) (break_statement))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (true))) consequence: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (character_literal))))))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (string_literal))))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (true))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (character_literal))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))))))) (if_statement condition: (parenthesized_expression (unary_expression operand: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (string_literal))))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))))))))