public static void main ( String [ ] $ ) {
  Scanner sc = new Scanner ( in ) ;
  int h = sc . nextInt ( ) ;
  int w = sc . nextInt ( ) ;
  char [ ] [ ] f = new char [ h ] [ w ] ;
  for ( int i = 0 ;
  i < h ;
  i ++ ) {
    String s = sc . next ( ) ;
    for ( int j = 0 ;
    j < w ;
    j ++ ) {
      f [ i ] [ j ] = s . charAt ( j ) ;
    }
  }
  Point p = new Point ( 0 , 0 ) ;
  int [ ] dx = {
    - 1 , 0 , 1 , 0 };
    int [ ] dy = {
      0 , - 1 , 0 , 1 };
      Deque < Point > stack = new ArrayDeque < > ( ) ;
      stack . addFirst ( p ) ;
      int k = 1 ;
      while ( stack . size ( ) > 0 ) {
        k ++ ;
        Point t = stack . pollFirst ( ) ;
        for ( int i = 0 ;
        i < 4 ;
        i ++ ) {
          int x = t . x + dx [ i ] , y = t . y + dy [ i ] ;
          if ( D ( h , w , x , y ) ) {
            if ( f [ y ] [ x ] == '#' ) {
              if ( i == 2 || i == 3 ) {
                stack . addFirst ( new Point ( x , y ) ) ;
                f [ t . y ] [ t . x ] = '0' ;
              }
              else {
                out . println ( "Impossible" ) ;
                exit ( 0 ) ;
              }
            }
          }
        }
        if ( stack . size ( ) > 1 ) {
          out . println ( "Impossible" ) ;
          exit ( 0 ) ;
        }
      }
      out . println ( "Possible" ) ;
    }
    
public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int h = sc . nextInt ( ) ; int w = sc . nextInt ( ) ; char [ ] [ ] f = new char [ h ] [ w ] ; for ( int i = 0 ; i < h ; i ++ ) { String s = sc . next ( ) ; for ( int j = 0 ; j < w ; j ++ ) { f [ i ] [ j ] = s . charAt ( j ) ; } } Point p = new Point ( 0 , 0 ) ; int [ ] dx = { - 1 , 0 , 1 , 0 } ; int [ ] dy = { 0 , - 1 , 0 , 1 } ; Deque < Point > stack = new ArrayDeque < > ( ) ; stack . addFirst ( p ) ; int k = 1 ; while ( stack . size ( ) > 0 ) { k ++ ; Point t = stack . pollFirst ( ) ; for ( int i = 0 ; i < 4 ; i ++ ) { int x = t . x + dx [ i ] , y = t . y + dy [ i ] ; if ( D ( h , w , x , y ) ) { if ( f [ y ] [ x ] == ' # ' ) { if ( i == 2 || i == 3 ) { stack . addFirst ( new Point ( x , y ) ) ; f [ t . y ] [ t . x ] = '0' ; } else { out . println ( " Impossible " ) ; exit ( 0 ) ; } } } } if ( stack . size ( ) > 1 ) { out . println ( " Impossible " ) ; exit ( 0 ) ; } } out . println ( " Possible " ) ; }
(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: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier))))) (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: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) 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 (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (decimal_integer_literal) (decimal_integer_literal))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_initializer (unary_expression operand: (decimal_integer_literal)) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_initializer (decimal_integer_literal) (unary_expression operand: (decimal_integer_literal)) (decimal_integer_literal) (decimal_integer_literal)))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments)) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) body: (block (expression_statement (update_expression (identifier))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) 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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (field_access object: (identifier) field: (identifier)) right: (array_access array: (identifier) index: (identifier)))) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (field_access object: (identifier) field: (identifier)) right: (array_access array: (identifier) index: (identifier))))) (if_statement condition: (parenthesized_expression (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (identifier)))) consequence: (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 (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier) (identifier)))))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (field_access object: (identifier) field: (identifier))) index: (field_access object: (identifier) field: (identifier))) right: (character_literal)))) alternative: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal)))))))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal)))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal))))))