public static int dfs ( int depth , String t , String p1 , String p2 ) {
  if ( depth == N ) {
    int sum1 = 0 ;
    int sum2 = 0 ;
    String [ ] p1_ary = p1 . split ( ":" ) ;
    String [ ] p2_ary = p2 . split ( ":" ) ;
    for ( int i = 0 ;
    i < p1_ary . length ;
    i ++ ) {
      sum1 += Integer . parseInt ( p1_ary [ i ] ) ;
    }
    for ( int i = 0 ;
    i < p2_ary . length ;
    i ++ ) {
      sum2 += Integer . parseInt ( p2_ary [ i ] ) ;
    }
    return Math . max ( sum1 , sum2 ) ;
  }
  String [ ] t_ary = t . split ( ":" ) ;
  String add = t_ary [ 0 ] ;
  String t_new = "" ;
  for ( int i = 1 ;
  i < t_ary . length ;
  i ++ ) {
    t_new += t_ary [ i ] ;
    if ( i != t_ary . length - 1 ) {
      t_new += ":" ;
    }
  }
  return Math . min ( dfs ( depth + 1 , t_new , p1 + ":" + add , p2 ) , dfs ( depth + 1 , t_new , p1 , p2 + ":" + add ) ) ;
}

public static int dfs ( int depth , String t , String p1 , String p2 ) { if ( depth == N ) { int sum1 = 0 ; int sum2 = 0 ; String [ ] p1_ary = p1 . split ( " : " ) ; String [ ] p2_ary = p2 . split ( " : " ) ; for ( int i = 0 ; i < p1_ary . length ; i ++ ) { sum1 += Integer . parseInt ( p1_ary [ i ] ) ; } for ( int i = 0 ; i < p2_ary . length ; i ++ ) { sum2 += Integer . parseInt ( p2_ary [ i ] ) ; } return Math . max ( sum1 , sum2 ) ; } String [ ] t_ary = t . split ( " : " ) ; String add = t_ary [ 0 ] ; String t_new = " " ; for ( int i = 1 ; i < t_ary . length ; i ++ ) { t_new += t_ary [ i ] ; if ( i != t_ary . length - 1 ) { t_new += " : " ; } } return Math . min ( dfs ( depth + 1 , t_new , p1 + " : " + add , p2 ) , dfs ( depth + 1 , t_new , p1 , p2 + " : " + add ) ) ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (type_identifier) name: (identifier)) (formal_parameter type: (type_identifier) name: (identifier)) (formal_parameter type: (type_identifier) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (array_type element: (type_identifier) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal))))) (local_variable_declaration type: (array_type element: (type_identifier) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (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: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))))))) (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier)))))) (local_variable_declaration type: (array_type element: (type_identifier) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (array_access array: (identifier) index: (decimal_integer_literal)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (string_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (field_access object: (identifier) field: (identifier)) right: (decimal_integer_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (string_literal))))))) (return_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier) (binary_expression left: (binary_expression left: (identifier) right: (string_literal)) right: (identifier)) (identifier))) (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier) (identifier) (binary_expression left: (binary_expression left: (identifier) right: (string_literal)) right: (identifier)))))))))