public static void main ( String args [ ] ) {
  Scanner scan = new Scanner ( System . in ) ;
  int T = scan . nextInt ( ) ;
  for ( int ca = 1 ;
  ca <= T ;
  ca ++ ) {
    boolean rtn = false ;
    int n = scan . nextInt ( ) ;
    int [ ] a = new int [ n - 1 ] ;
    for ( int i = 0 ;
    i < n - 1 ;
    i ++ ) a [ i ] = scan . nextInt ( ) - 1 ;
    int TRIALS = 10000000 ;
    int [ ] h = new int [ n ] ;
    while ( TRIALS -- > 0 ) {
      boolean good = true ;
      for ( int i = 0 ;
      i < n - 1 ;
      i ++ ) {
        double m = - 999999999 ;
        int max = - 1 ;
        for ( int j = i + 1 ;
        j < n ;
        j ++ ) {
          double tm = ( double ) ( h [ j ] - h [ i ] ) / ( j - i ) ;
          if ( tm > m ) {
            m = tm ;
            max = j ;
          }
        }
        if ( max != a [ i ] ) {
          good = false ;
          h [ a [ i ] ] ++ ;
          break ;
        }
      }
      if ( good ) break ;
    }
    System . out . print ( "Case #" + ca + ":" ) ;
    if ( TRIALS <= 0 ) System . out . println ( " Impossible" ) ;
    else {
      for ( int i = 0 ;
      i < n ;
      i ++ ) System . out . print ( " " + h [ i ] ) ;
      System . out . println ( ) ;
    }
  }
}

public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int T = scan . nextInt ( ) ; for ( int ca = 1 ; ca <= T ; ca ++ ) { boolean rtn = false ; int n = scan . nextInt ( ) ; int [ ] a = new int [ n - 1 ] ; for ( int i = 0 ; i < n - 1 ; i ++ ) a [ i ] = scan . nextInt ( ) - 1 ; int TRIALS = 10000000 ; int [ ] h = new int [ n ] ; while ( TRIALS -- > 0 ) { boolean good = true ; for ( int i = 0 ; i < n - 1 ; i ++ ) { double m = - 999999999 ; int max = - 1 ; for ( int j = i + 1 ; j < n ; j ++ ) { double tm = ( double ) ( h [ j ] - h [ i ] ) / ( j - i ) ; if ( tm > m ) { m = tm ; max = j ; } } if ( max != a [ i ] ) { good = false ; h [ a [ i ] ] ++ ; break ; } } if ( good ) break ; } System . out . print ( " Case ▁ # " + ca + " : " ) ; if ( TRIALS <= 0 ) System . out . println ( " ▁ Impossible " ) ; else { for ( int i = 0 ; i < n ; i ++ ) System . out . print ( " ▁ " + h [ i ] ) ; System . out . println ( ) ; } } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) 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: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (false))) (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: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (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: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (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: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (while_statement condition: (parenthesized_expression (binary_expression left: (update_expression (identifier)) right: (decimal_integer_literal))) 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: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (unary_expression operand: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (unary_expression operand: (decimal_integer_literal)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (cast_expression type: (floating_point_type) value: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier))))) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (false))) (expression_statement (update_expression (array_access array: (identifier) index: (array_access array: (identifier) index: (identifier))))) (break_statement))))) (if_statement condition: (parenthesized_expression (identifier)) consequence: (break_statement)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (string_literal) right: (identifier)) right: (string_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) alternative: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (string_literal) right: (array_access array: (identifier) index: (identifier))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list)))))))))