public static void main ( String [ ] Args ) throws Exception {
  Scanner sc = new Scanner ( new File ( "B-large.in" ) ) ;
  PrintWriter out = new PrintWriter ( new BufferedWriter ( new FileWriter ( new File ( "b.out" ) ) ) ) ;
  int cc = 0 ;
  int t = sc . nextInt ( ) ;
  while ( t -- > 0 ) {
    String x = sc . next ( ) ;
    for ( int i = 0 ;
    i < x . length ( ) ;
    i ++ ) for ( int j = 0 ;
    j + 1 < x . length ( ) ;
    j ++ ) if ( x . charAt ( j ) > x . charAt ( j + 1 ) ) {
      String nx = x . substring ( 0 , j ) ;
      nx = nx + ( char ) ( x . charAt ( j ) - 1 ) ;
      while ( nx . length ( ) < x . length ( ) ) nx = nx + "9" ;
      x = nx ;
    }
    while ( x . length ( ) > 1 && x . charAt ( 0 ) == '0' ) x = x . substring ( 1 ) ;
    out . printf ( "Case #%d: %s%n" , ++ cc , x ) ;
  }
  out . close ( ) ;
}

public static void main ( String [ ] Args ) throws Exception { Scanner sc = new Scanner ( new File ( " B - large . in " ) ) ; PrintWriter out = new PrintWriter ( new BufferedWriter ( new FileWriter ( new File ( " b . out " ) ) ) ) ; int cc = 0 ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { String x = sc . next ( ) ; for ( int i = 0 ; i < x . length ( ) ; i ++ ) for ( int j = 0 ; j + 1 < x . length ( ) ; j ++ ) if ( x . charAt ( j ) > x . charAt ( j + 1 ) ) { String nx = x . substring ( 0 , j ) ; nx = nx + ( char ) ( x . charAt ( j ) - 1 ) ; while ( nx . length ( ) < x . length ( ) ) nx = nx + "9" ; x = nx ; } while ( x . length ( ) > 1 && x . charAt ( 0 ) == '0' ) x = x . substring ( 1 ) ; out . printf ( " Case ▁ # % d : ▁ % s % n " , ++ cc , x ) ; } out . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) (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 (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 (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: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (while_statement condition: (parenthesized_expression (binary_expression left: (update_expression (identifier)) right: (decimal_integer_literal))) body: (block (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))))) consequence: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (cast_expression type: (integral_type) value: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (decimal_integer_literal))))))) (while_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) body: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (string_literal))))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (character_literal)))) body: (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal) (update_expression (identifier)) (identifier)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))