public static void main ( String [ ] args ) throws IOException {
  Scanner sc = new Scanner ( new InputStreamReader ( System . in ) ) ;
  int T = sc . nextInt ( ) ;
  for ( int t = 1 ;
  t <= T ;
  t ++ ) {
    int N = sc . nextInt ( ) ;
    int [ ] [ ] nums = new int [ N ] [ 3 ] ;
    for ( int i = 0 ;
    i < N ;
    i ++ ) for ( int j = 0 ;
    j < 3 ;
    j ++ ) nums [ i ] [ j ] = sc . nextInt ( ) ;
    int ans = 0 ;
    for ( int i = 0 ;
    i < N ;
    i ++ ) {
      Vector < Integer > low = new Vector < Integer > ( ) ;
      Vector < Integer > high = new Vector < Integer > ( ) ;
      int cur = 0 ;
      int A = nums [ i ] [ 0 ] ;
      for ( int j = 0 ;
      j < N ;
      j ++ ) {
        if ( A < nums [ j ] [ 0 ] ) continue ;
        if ( nums [ j ] [ 1 ] <= 10000 - A - nums [ j ] [ 2 ] ) {
          low . add ( nums [ j ] [ 1 ] ) ;
          high . add ( 10000 - A - nums [ j ] [ 2 ] ) ;
        }
      }
      if ( low . size ( ) == 0 ) continue ;
      Collections . sort ( low ) ;
      Collections . sort ( high ) ;
      int lc = 0 , hc = 0 , lcur = low . get ( 0 ) , hcur = high . get ( 0 ) ;
      while ( lc < low . size ( ) ) {
        if ( lcur <= hcur ) {
          cur ++ ;
          ans = Math . max ( ans , cur ) ;
          lc ++ ;
          if ( lc < low . size ( ) ) lcur = low . get ( lc ) ;
        }
        else {
          cur -- ;
          hc ++ ;
          if ( hc < high . size ( ) ) hcur = high . get ( hc ) ;
        }
      }
    }
    System . out . println ( "Case #" + t + ": " + ans ) ;
  }
}

public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( new InputStreamReader ( System . in ) ) ; int T = sc . nextInt ( ) ; for ( int t = 1 ; t <= T ; t ++ ) { int N = sc . nextInt ( ) ; int [ ] [ ] nums = new int [ N ] [ 3 ] ; for ( int i = 0 ; i < N ; i ++ ) for ( int j = 0 ; j < 3 ; j ++ ) nums [ i ] [ j ] = sc . nextInt ( ) ; int ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { Vector < Integer > low = new Vector < Integer > ( ) ; Vector < Integer > high = new Vector < Integer > ( ) ; int cur = 0 ; int A = nums [ i ] [ 0 ] ; for ( int j = 0 ; j < N ; j ++ ) { if ( A < nums [ j ] [ 0 ] ) continue ; if ( nums [ j ] [ 1 ] <= 10000 - A - nums [ j ] [ 2 ] ) { low . add ( nums [ j ] [ 1 ] ) ; high . add ( 10000 - A - nums [ j ] [ 2 ] ) ; } } if ( low . size ( ) == 0 ) continue ; Collections . sort ( low ) ; Collections . sort ( high ) ; int lc = 0 , hc = 0 , lcur = low . get ( 0 ) , hcur = high . get ( 0 ) ; while ( lc < low . size ( ) ) { if ( lcur <= hcur ) { cur ++ ; ans = Math . max ( ans , cur ) ; lc ++ ; if ( lc < low . size ( ) ) lcur = low . get ( lc ) ; } else { cur -- ; hc ++ ; if ( hc < high . size ( ) ) hcur = high . get ( hc ) ; } } } System . out . println ( " Case ▁ # " + t + " : ▁ " + ans ) ; } }
(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 (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: (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 (identifier)) dimensions: (dimensions_expr (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: (identifier)) 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: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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: (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 (type_identifier))) arguments: (argument_list)))) (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 (type_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: (array_access array: (array_access array: (identifier) index: (identifier)) index: (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: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)))) consequence: (continue_statement)) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (identifier)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal))))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (identifier)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)))))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) consequence: (continue_statement)) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal)))) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (update_expression (identifier))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))))) (expression_statement (update_expression (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) consequence: (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))))) alternative: (block (expression_statement (update_expression (identifier))) (expression_statement (update_expression (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) consequence: (expression_statement (assignment_expression left: (identifier) right: (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 (binary_expression left: (binary_expression left: (binary_expression left: (string_literal) right: (identifier)) right: (string_literal)) right: (identifier)))))))))