private static void sport ( int [ ] a , int h ) {
  boolean f = true ;
  for ( int i = 1 ;
  i < a . length ;
  i ++ ) {
    if ( a [ i - 1 ] > 1 && a [ i ] > 1 ) {
      f = false ;
      break ;
    }
  }
  if ( f ) {
    System . out . println ( "perfect" ) ;
    return ;
  }
  System . out . println ( "ambiguous" ) ;
  System . out . print ( "0 " ) ;
  LinkedList < Integer > queue = new LinkedList < > ( ) ;
  queue . add ( 1 ) ;
  for ( int i = 1 ;
  i < a . length ;
  i ++ ) {
    LinkedList < Integer > q = new LinkedList < > ( ) ;
    Integer poll = queue . removeLast ( ) ;
    for ( int j = 0 ;
    j < a [ i ] ;
    j ++ ) {
      System . out . print ( poll + " " ) ;
      q . addLast ( poll + j + 1 ) ;
    }
    queue . clear ( ) ;
    queue . addAll ( q ) ;
  }
  System . out . println ( ) ;
  ;
}

private static void sport ( int [ ] a , int h ) { boolean f = true ; for ( int i = 1 ; i < a . length ; i ++ ) { if ( a [ i - 1 ] > 1 && a [ i ] > 1 ) { f = false ; break ; } } if ( f ) { System . out . println ( " perfect " ) ; return ; } System . out . println ( " ambiguous " ) ; System . out . print ( "0 ▁ " ) ; LinkedList < Integer > queue = new LinkedList < > ( ) ; queue . add ( 1 ) ; for ( int i = 1 ; i < a . length ; i ++ ) { LinkedList < Integer > q = new LinkedList < > ( ) ; Integer poll = queue . removeLast ( ) ; for ( int j = 0 ; j < a [ i ] ; j ++ ) { System . out . print ( poll + " ▁ " ) ; q . addLast ( poll + j + 1 ) ; } queue . clear ( ) ; queue . addAll ( q ) ; } System . out . println ( ) ; ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (true))) (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 (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (false))) (break_statement))))) (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (return_statement))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments)) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_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 (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments)) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))) update: (update_expression (identifier)) body: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (string_literal))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list)))))