public static void main ( String [ ] Args ) throws Exception {
  Scanner sc = new Scanner ( new File ( "C-large.in" ) ) ;
  PrintWriter out = new PrintWriter ( new BufferedWriter ( new FileWriter ( new File ( "c.out" ) ) ) ) ;
  int cc = 0 ;
  int t = sc . nextInt ( ) ;
  while ( t -- > 0 ) {
    long n = sc . nextLong ( ) ;
    long pos = sc . nextLong ( ) ;
    int dep = 0 ;
    long v = 0 ;
    while ( pos > ( ( v << 1 ) | 1 ) ) {
      v = ( ( v << 1 ) | 1 ) ;
      dep ++ ;
    }
    n -= v ;
    pos -= v + 1 ;
    v ++ ;
    if ( n % v > pos ) n = n / v + 1 ;
    else n = n / v ;
    out . printf ( "Case #%d: %d %d%n" , ++ cc , n >> 1 , ( n - 1 ) >> 1 ) ;
  }
  out . close ( ) ;
}

public static void main ( String [ ] Args ) throws Exception { Scanner sc = new Scanner ( new File ( " C - large . in " ) ) ; PrintWriter out = new PrintWriter ( new BufferedWriter ( new FileWriter ( new File ( " c . out " ) ) ) ) ; int cc = 0 ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { long n = sc . nextLong ( ) ; long pos = sc . nextLong ( ) ; int dep = 0 ; long v = 0 ; while ( pos > ( ( v << 1 ) | 1 ) ) { v = ( ( v << 1 ) | 1 ) ; dep ++ ; } n -= v ; pos -= v + 1 ; v ++ ; if ( n % v > pos ) n = n / v + 1 ; else n = n / v ; out . printf ( " Case ▁ # % d : ▁ % d ▁ % d % n " , ++ cc , n >> 1 , ( n - 1 ) >> 1 ) ; } 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: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (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: (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))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))))) body: (block (expression_statement (assignment_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))))) (expression_statement (update_expression (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (expression_statement (update_expression (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier))) consequence: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))) alternative: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal) (update_expression (identifier)) (binary_expression left: (identifier) right: (decimal_integer_literal)) (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))