public static void main ( String [ ] args ) throws IOException {
  BufferedReader in = new BufferedReader ( new FileReader ( "B.in" ) ) ;
  PrintWriter out = new PrintWriter ( new BufferedWriter ( new FileWriter ( "B.out" ) ) ) ;
  StringTokenizer st ;
  int T = Integer . parseInt ( in . readLine ( ) ) ;
  for ( int caseNum = 1 ;
  caseNum <= T ;
  caseNum ++ ) {
    int N = Integer . parseInt ( in . readLine ( ) ) ;
    double xPos = 0.0 ;
    double yPos = 0.0 ;
    double zPos = 0.0 ;
    double xVel = 0.0 ;
    double yVel = 0.0 ;
    double zVel = 0.0 ;
    double time ;
    double distance ;
    for ( int i = 0 ;
    i < N ;
    i ++ ) {
      st = new StringTokenizer ( in . readLine ( ) ) ;
      xPos += Double . parseDouble ( st . nextToken ( ) ) ;
      yPos += Double . parseDouble ( st . nextToken ( ) ) ;
      zPos += Double . parseDouble ( st . nextToken ( ) ) ;
      xVel += Double . parseDouble ( st . nextToken ( ) ) ;
      yVel += Double . parseDouble ( st . nextToken ( ) ) ;
      zVel += Double . parseDouble ( st . nextToken ( ) ) ;
    }
    xPos /= ( double ) N ;
    yPos /= ( double ) N ;
    zPos /= ( double ) N ;
    xVel /= ( double ) N ;
    yVel /= ( double ) N ;
    zVel /= ( double ) N ;
    if ( xVel == 0.0 && yVel == 0.0 && zVel == 0.0 ) {
      time = 0 ;
      distance = Math . sqrt ( xPos * xPos + yPos * yPos + zPos * zPos ) ;
    }
    else {
      time = - ( xPos * xVel + yPos * yVel + zPos * zVel ) / ( xVel * xVel + yVel * yVel + zVel * zVel ) ;
      if ( time < 0 ) time = 0 ;
      double xNew = xPos + time * xVel ;
      double yNew = yPos + time * yVel ;
      double zNew = zPos + time * zVel ;
      distance = Math . sqrt ( xNew * xNew + yNew * yNew + zNew * zNew ) ;
    }
    out . println ( "Case #" + caseNum + ": " + distance + " " + time ) ;
  }
  in . close ( ) ;
  out . close ( ) ;
  System . exit ( 0 ) ;
}

public static void main ( String [ ] args ) throws IOException { BufferedReader in = new BufferedReader ( new FileReader ( " B . in " ) ) ; PrintWriter out = new PrintWriter ( new BufferedWriter ( new FileWriter ( " B . out " ) ) ) ; StringTokenizer st ; int T = Integer . parseInt ( in . readLine ( ) ) ; for ( int caseNum = 1 ; caseNum <= T ; caseNum ++ ) { int N = Integer . parseInt ( in . readLine ( ) ) ; double xPos = 0.0 ; double yPos = 0.0 ; double zPos = 0.0 ; double xVel = 0.0 ; double yVel = 0.0 ; double zVel = 0.0 ; double time ; double distance ; for ( int i = 0 ; i < N ; i ++ ) { st = new StringTokenizer ( in . readLine ( ) ) ; xPos += Double . parseDouble ( st . nextToken ( ) ) ; yPos += Double . parseDouble ( st . nextToken ( ) ) ; zPos += Double . parseDouble ( st . nextToken ( ) ) ; xVel += Double . parseDouble ( st . nextToken ( ) ) ; yVel += Double . parseDouble ( st . nextToken ( ) ) ; zVel += Double . parseDouble ( st . nextToken ( ) ) ; } xPos /= ( double ) N ; yPos /= ( double ) N ; zPos /= ( double ) N ; xVel /= ( double ) N ; yVel /= ( double ) N ; zVel /= ( double ) N ; if ( xVel == 0.0 && yVel == 0.0 && zVel == 0.0 ) { time = 0 ; distance = Math . sqrt ( xPos * xPos + yPos * yPos + zPos * zPos ) ; } else { time = - ( xPos * xVel + yPos * yVel + zPos * zVel ) / ( xVel * xVel + yVel * yVel + zVel * zVel ) ; if ( time < 0 ) time = 0 ; double xNew = xPos + time * xVel ; double yNew = yPos + time * yVel ; double zNew = zPos + time * zVel ; distance = Math . sqrt ( xNew * xNew + yNew * yNew + zNew * zNew ) ; } out . println ( " Case ▁ # " + caseNum + " : ▁ " + distance + " ▁ " + time ) ; } in . close ( ) ; out . close ( ) ; System . exit ( 0 ) ; }
(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 (string_literal))))))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (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 (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (decimal_floating_point_literal))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (decimal_floating_point_literal))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (decimal_floating_point_literal))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (decimal_floating_point_literal))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (decimal_floating_point_literal))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (decimal_floating_point_literal))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier))) (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 (expression_statement (assignment_expression left: (identifier) right: (object_creation_expression type: (type_identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (floating_point_type) value: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (floating_point_type) value: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (floating_point_type) value: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (floating_point_type) value: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (floating_point_type) value: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (floating_point_type) value: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (decimal_floating_point_literal)) right: (binary_expression left: (identifier) right: (decimal_floating_point_literal))) right: (binary_expression left: (identifier) right: (decimal_floating_point_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier))) right: (binary_expression left: (identifier) right: (identifier)))))))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (unary_expression operand: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier))) right: (binary_expression left: (identifier) right: (identifier))))) right: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier))) right: (binary_expression left: (identifier) right: (identifier))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier))) right: (binary_expression left: (identifier) right: (identifier))))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (string_literal) right: (identifier)) right: (string_literal)) right: (identifier)) right: (string_literal)) right: (identifier))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))))