static boolean check ( int u , int color , int p ) {
  for ( int v : al [ u ] ) {
    if ( v == p ) continue ;
    if ( color != - 1 && c [ v ] != color ) return false ;
    if ( ! check ( v , c [ v ] , u ) ) return false ;
  }
  return true ;
}

static boolean check ( int u , int color , int p ) { for ( int v : al [ u ] ) { if ( v == p ) continue ; if ( color != - 1 && c [ v ] != color ) return false ; if ( ! check ( v , c [ v ] , u ) ) return false ; } return true ; }
(method_declaration (modifiers) type: (boolean_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (enhanced_for_statement type: (integral_type) name: (identifier) value: (array_access array: (identifier) index: (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (continue_statement)) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (unary_expression operand: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)))) consequence: (return_statement (false))) (if_statement condition: (parenthesized_expression (unary_expression operand: (method_invocation name: (identifier) arguments: (argument_list (identifier) (array_access array: (identifier) index: (identifier)) (identifier))))) consequence: (return_statement (false))))) (return_statement (true))))