public static void main ( String args [ ] ) throws Exception {
  PrintWriter output = new PrintWriter ( "output.txt" ) ;
  Scanner s = new Scanner ( new File ( "input.txt" ) ) ;
  int ball = s . nextInt ( ) ;
  int i = 3 ;
  while ( i -- > 0 ) {
    int a = s . nextInt ( ) ;
    int b = s . nextInt ( ) ;
    if ( a == ball ) {
      ball = b ;
    }
    else if ( b == ball ) {
      ball = a ;
    }
  }
  output . println ( ball ) ;
  output . flush ( ) ;
}

public static void main ( String args [ ] ) throws Exception { PrintWriter output = new PrintWriter ( " output . txt " ) ; Scanner s = new Scanner ( new File ( " input . txt " ) ) ; int ball = s . nextInt ( ) ; int i = 3 ; while ( i -- > 0 ) { int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; if ( a == ball ) { ball = b ; } else if ( b == ball ) { ball = a ; } } output . println ( ball ) ; output . flush ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) (throws (type_identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (string_literal))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (string_literal))))))) (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: (decimal_integer_literal))) (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: (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)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier)))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))