public static void solve ( ArrayList < Pair > arr , int sze , int maxR ) {
  Collections . sort ( arr , new sortByL ( ) ) ;
  Pair P = arr . get ( 0 ) ;
  int a = P . l ;
  int b = P . r ;
  if ( a <= b && b >= maxR ) System . out . println ( P . index + 1 ) ;
  else System . out . println ( "-1" ) ;
}

public static void solve ( ArrayList < Pair > arr , int sze , int maxR ) { Collections . sort ( arr , new sortByL ( ) ) ; Pair P = arr . get ( 0 ) ; int a = P . l ; int b = P . r ; if ( a <= b && b >= maxR ) System . out . println ( P . index + 1 ) ; else System . out . println ( " - 1" ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (generic_type (type_identifier) (type_arguments (type_identifier))) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (object_creation_expression type: (type_identifier) arguments: (argument_list))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (field_access object: (identifier) field: (identifier)) right: (decimal_integer_literal))))) alternative: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))))))