public static void main ( String [ ] args ) {
  Scanner stdin = new Scanner ( System . in ) ;
  int N , M ;
  int a , b ;
  List < Integer > alist = new ArrayList < Integer > ( ) ;
  List < Integer > blist = new ArrayList < Integer > ( ) ;
  N = stdin . nextInt ( ) ;
  M = stdin . nextInt ( ) ;
  for ( int i = 1 ;
  i <= M ;
  i ++ ) {
    a = stdin . nextInt ( ) ;
    b = stdin . nextInt ( ) ;
    if ( a == 1 ) alist . add ( b ) ;
    if ( b == N ) blist . add ( a ) ;
  }
  Collections . sort ( alist ) ;
  Collections . sort ( blist ) ;
  Stack < Integer > astack = new Stack < Integer > ( ) ;
  Stack < Integer > bstack = new Stack < Integer > ( ) ;
  for ( int i = 0 ;
  i < alist . size ( ) ;
  i ++ ) {
    astack . push ( alist . get ( i ) ) ;
  }
  for ( int i = 0 ;
  i < blist . size ( ) ;
  i ++ ) {
    bstack . push ( blist . get ( i ) ) ;
  }
  if ( astack . empty ( ) || bstack . empty ( ) ) {
    System . out . print ( "IMPOSSIBLE" ) ;
    System . exit ( 0 ) ;
  }
  a = astack . pop ( ) ;
  b = bstack . pop ( ) ;
  do {
    if ( a < b ) {
      if ( bstack . empty ( ) ) break ;
      b = bstack . pop ( ) ;
    }
    if ( a > b ) {
      if ( astack . empty ( ) ) break ;
      a = astack . pop ( ) ;
    }
    if ( a == b ) {
      System . out . print ( "POSSIBLE" ) ;
      System . exit ( 0 ) ;
    }
  }
  while ( true ) ;
  System . out . print ( "IMPOSSIBLE" ) ;
}

public static void main ( String [ ] args ) { Scanner stdin = new Scanner ( System . in ) ; int N , M ; int a , b ; List < Integer > alist = new ArrayList < Integer > ( ) ; List < Integer > blist = new ArrayList < Integer > ( ) ; N = stdin . nextInt ( ) ; M = stdin . nextInt ( ) ; for ( int i = 1 ; i <= M ; i ++ ) { a = stdin . nextInt ( ) ; b = stdin . nextInt ( ) ; if ( a == 1 ) alist . add ( b ) ; if ( b == N ) blist . add ( a ) ; } Collections . sort ( alist ) ; Collections . sort ( blist ) ; Stack < Integer > astack = new Stack < Integer > ( ) ; Stack < Integer > bstack = new Stack < Integer > ( ) ; for ( int i = 0 ; i < alist . size ( ) ; i ++ ) { astack . push ( alist . get ( i ) ) ; } for ( int i = 0 ; i < blist . size ( ) ; i ++ ) { bstack . push ( blist . get ( i ) ) ; } if ( astack . empty ( ) || bstack . empty ( ) ) { System . out . print ( " IMPOSSIBLE " ) ; System . exit ( 0 ) ; } a = astack . pop ( ) ; b = bstack . pop ( ) ; do { if ( a < b ) { if ( bstack . empty ( ) ) break ; b = bstack . pop ( ) ; } if ( a > b ) { if ( astack . empty ( ) ) break ; a = astack . pop ( ) ; } if ( a == b ) { System . out . print ( " POSSIBLE " ) ; System . exit ( 0 ) ; } } while ( true ) ; System . out . print ( " IMPOSSIBLE " ) ; }
(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 (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier))) (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 (type_identifier))) arguments: (argument_list)))) (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 (type_identifier))) arguments: (argument_list)))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (identifier) right: (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: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (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 (type_identifier))) arguments: (argument_list)))) (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 (type_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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (do_statement body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) consequence: (break_statement)) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) consequence: (break_statement)) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))))) condition: (parenthesized_expression (true))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))))