public static void main ( String args [ ] ) {
  Scanner sc = new Scanner ( System . in ) ;
  int n = sc . nextInt ( ) , m = sc . nextInt ( ) ;
  ArrayList < HashSet < Integer >> graph = new ArrayList < > ( ) ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) graph . add ( new HashSet < > ( ) ) ;
  while ( m -- > 0 ) {
    int u = sc . nextInt ( ) - 1 , v = sc . nextInt ( ) - 1 ;
    graph . get ( u ) . add ( v ) ;
    graph . get ( v ) . add ( u ) ;
  }
  int u = - 1 , v = - 1 ;
  outer : for ( int i = 0 ;
  i < n ;
  i ++ ) {
    if ( graph . get ( i ) . size ( ) < n - 1 ) {
      u = i ;
      for ( int j = 0 ;
      j < n ;
      j ++ ) {
        if ( i == j ) continue ;
        else if ( ! graph . get ( i ) . contains ( j ) ) {
          v = j ;
          break outer ;
        }
      }
    }
  };
}

public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) , m = sc . nextInt ( ) ; ArrayList < HashSet < Integer > > graph = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) graph . add ( new HashSet < > ( ) ) ; while ( m -- > 0 ) { int u = sc . nextInt ( ) - 1 , v = sc . nextInt ( ) - 1 ; graph . get ( u ) . add ( v ) ; graph . get ( v ) . add ( u ) ; } int u = - 1 , v = - 1 ; outer : for ( int i = 0 ; i < n ; i ++ ) { if ( graph . get ( i ) . size ( ) < n - 1 ) { u = i ; for ( int j = 0 ; j < n ; j ++ ) { if ( i == j ) continue ; else if ( ! graph . get ( i ) . contains ( j ) ) { v = j ; break outer ; } } } } ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) 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) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (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)))) (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 (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (object_creation_expression type: (generic_type (type_identifier) (type_arguments)) arguments: (argument_list)))))) (while_statement condition: (parenthesized_expression (binary_expression left: (update_expression (identifier)) right: (decimal_integer_literal))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))) (expression_statement (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) name: (identifier) arguments: (argument_list (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (unary_expression operand: (decimal_integer_literal))) declarator: (variable_declarator name: (identifier) value: (unary_expression operand: (decimal_integer_literal)))) (labeled_statement (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 (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) name: (identifier) arguments: (argument_list)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (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 (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (continue_statement) alternative: (if_statement condition: (parenthesized_expression (unary_expression operand: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) name: (identifier) arguments: (argument_list (identifier))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (break_statement (identifier))))))))))))))