public static void main ( String [ ] args ) throws IOException {
  st . nextToken ( ) ;
  n = ( int ) st . nval ;
  int a , b ;
  while ( n -- > 0 ) {
    st . nextToken ( ) ;
    a = ( int ) st . nval ;
    st . nextToken ( ) ;
    b = ( int ) st . nval ;
    map . put ( a , b ) ;
  }
  int k1 , k2 ;
  boolean flag = false ;
  for ( Map . Entry < Integer , Integer > entry : map . entrySet ( ) ) {
    k1 = entry . getKey ( ) + entry . getValue ( ) ;
    if ( map . containsKey ( k1 ) ) {
      k2 = k1 + map . get ( k1 ) ;
      if ( k2 == entry . getKey ( ) ) {
        flag = true ;
        break ;
      }
    }
  }
  bw . write ( flag ? "YES" : "NO" ) ;
  bw . close ( ) ;
}

public static void main ( String [ ] args ) throws IOException { st . nextToken ( ) ; n = ( int ) st . nval ; int a , b ; while ( n -- > 0 ) { st . nextToken ( ) ; a = ( int ) st . nval ; st . nextToken ( ) ; b = ( int ) st . nval ; map . put ( a , b ) ; } int k1 , k2 ; boolean flag = false ; for ( Map . Entry < Integer , Integer > entry : map . entrySet ( ) ) { k1 = entry . getKey ( ) + entry . getValue ( ) ; if ( map . containsKey ( k1 ) ) { k2 = k1 + map . get ( k1 ) ; if ( k2 == entry . getKey ( ) ) { flag = true ; break ; } } } bw . write ( flag ? " YES " : " NO " ) ; bw . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) (throws (type_identifier)) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (integral_type) value: (field_access object: (identifier) field: (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier))) (while_statement condition: (parenthesized_expression (binary_expression left: (update_expression (identifier)) right: (decimal_integer_literal))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (integral_type) value: (field_access object: (identifier) field: (identifier))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (integral_type) value: (field_access object: (identifier) field: (identifier))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (false))) (enhanced_for_statement type: (generic_type (scoped_type_identifier (type_identifier) (type_identifier)) (type_arguments (type_identifier) (type_identifier))) name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) body: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (true))) (break_statement))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (ternary_expression condition: (identifier) consequence: (string_literal) alternative: (string_literal))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))