public static void main ( String [ ] args ) {
  int timeData = 0 ;
  int [ ] [ ] times = new int [ 289 ] [ 2 ] ;
  for ( int i = 0 ;
  i < 289 ;
  i ++ ) {
    times [ i ] [ 0 ] = timeData ;
    timeData += 5 ;
    if ( i != 0 && ( times [ i ] [ 0 ] % 100 ) == 55 ) timeData = ( timeData / 100 + 1 ) * 100 ;
  }
  Scanner sc = new Scanner ( System . in ) ;
  int inputCount = sc . nextInt ( ) ;
  for ( int i = 0 ;
  i < inputCount ;
  i ++ ) {
    String [ ] lainTime = sc . next ( ) . split ( "-" ) ;
    int from = Integer . valueOf ( lainTime [ 0 ] ) ;
    int to = Integer . valueOf ( lainTime [ 1 ] ) ;
    from = from - from % 5 ;
    for ( int j = 0 ;
    j < 289 ;
    j ++ ) {
      if ( times [ j ] [ 0 ] >= from && times [ j ] [ 0 ] < to ) times [ j ] [ 1 ] = 1 ;
    }
  }
  ArrayList < String > resultList = new ArrayList < > ( ) ;
  String result = "" ;
  boolean isContinue = false ;
  for ( int i = 0 ;
  i < times . length ;
  i ++ ) {
    if ( isContinue ) {
      if ( times [ i ] [ 1 ] == 0 ) {
        isContinue = false ;
        String intResult = "0000" + times [ i ] [ 0 ] ;
        result += "-" + intResult . substring ( intResult . length ( ) - 4 ) ;
        resultList . add ( result ) ;
        result = "" ;
      }
    }
    else {
      if ( times [ i ] [ 1 ] == 1 ) {
        isContinue = true ;
        result = "0000" + ( times [ i ] [ 0 ] ) ;
        result = result . substring ( result . length ( ) - 4 ) ;
      }
    }
    if ( isContinue && i == 288 ) {
      result += "-2400" ;
      resultList . add ( result ) ;
    }
  }
  for ( String output : resultList ) {
    System . out . println ( output ) ;
  }
}

public static void main ( String [ ] args ) { int timeData = 0 ; int [ ] [ ] times = new int [ 289 ] [ 2 ] ; for ( int i = 0 ; i < 289 ; i ++ ) { times [ i ] [ 0 ] = timeData ; timeData += 5 ; if ( i != 0 && ( times [ i ] [ 0 ] % 100 ) == 55 ) timeData = ( timeData / 100 + 1 ) * 100 ; } Scanner sc = new Scanner ( System . in ) ; int inputCount = sc . nextInt ( ) ; for ( int i = 0 ; i < inputCount ; i ++ ) { String [ ] lainTime = sc . next ( ) . split ( " - " ) ; int from = Integer . valueOf ( lainTime [ 0 ] ) ; int to = Integer . valueOf ( lainTime [ 1 ] ) ; from = from - from % 5 ; for ( int j = 0 ; j < 289 ; j ++ ) { if ( times [ j ] [ 0 ] >= from && times [ j ] [ 0 ] < to ) times [ j ] [ 1 ] = 1 ; } } ArrayList < String > resultList = new ArrayList < > ( ) ; String result = " " ; boolean isContinue = false ; for ( int i = 0 ; i < times . length ; i ++ ) { if ( isContinue ) { if ( times [ i ] [ 1 ] == 0 ) { isContinue = false ; String intResult = "0000" + times [ i ] [ 0 ] ; result += " - " + intResult . substring ( intResult . length ( ) - 4 ) ; resultList . add ( result ) ; result = " " ; } } else { if ( times [ i ] [ 1 ] == 1 ) { isContinue = true ; result = "0000" + ( times [ i ] [ 0 ] ) ; result = result . substring ( result . length ( ) - 4 ) ; } } if ( isContinue && i == 288 ) { result += " - 2400" ; resultList . add ( result ) ; } } for ( String output : resultList ) { System . out . println ( output ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (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 (decimal_integer_literal)) 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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (decimal_integer_literal))) right: (decimal_integer_literal)))) consequence: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) right: (decimal_integer_literal))))))) (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: (array_type element: (type_identifier) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (string_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (identifier)) right: (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (identifier)))) consequence: (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (decimal_integer_literal)))))))) (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)) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (string_literal))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (false))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (false))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (string_literal) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (string_literal) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (string_literal)))))) alternative: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (true))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (string_literal) right: (parenthesized_expression (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (string_literal))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))))) (enhanced_for_statement type: (type_identifier) name: (identifier) value: (identifier) body: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))))