public static void main ( String [ ] args ) throws IOException {
  st . nextToken ( ) ;
  t = ( int ) st . nval ;
  int a , b , k ;
  while ( t -- > 0 ) {
    st . nextToken ( ) ;
    n = ( int ) st . nval ;
    k = 1 ;
    for ( int i = 0 ;
    i < n ;
    ++ i ) {
      st . nextToken ( ) ;
      a = ( int ) st . nval ;
      st . nextToken ( ) ;
      b = ( int ) st . nval ;
      pq . add ( new Node ( a , b , i ) ) ;
    }
    while ( ! pq . isEmpty ( ) ) {
      if ( k < pq . peek ( ) . a ) {
        k = pq . peek ( ) . a ;
      }
      bw . write ( ( k > pq . poll ( ) . b ? 0 : k ++ ) + " " ) ;
    }
    bw . write ( "\n" ) ;
  }
  bw . close ( ) ;
}

public static void main ( String [ ] args ) throws IOException { st . nextToken ( ) ; t = ( int ) st . nval ; int a , b , k ; while ( t -- > 0 ) { st . nextToken ( ) ; n = ( int ) st . nval ; k = 1 ; for ( int i = 0 ; i < n ; ++ i ) { st . nextToken ( ) ; a = ( int ) st . nval ; st . nextToken ( ) ; b = ( int ) st . nval ; pq . add ( new Node ( a , b , i ) ) ; } while ( ! pq . isEmpty ( ) ) { if ( k < pq . peek ( ) . a ) { k = pq . peek ( ) . a ; } bw . write ( ( k > pq . poll ( ) . b ? 0 : k ++ ) + " ▁ " ) ; } bw . write ( " \n " ) ; } bw . 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 (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (integral_type) value: (field_access object: (identifier) field: (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier))) (while_statement condition: (parenthesized_expression (binary_expression left: (update_expression (identifier)) right: (decimal_integer_literal))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (integral_type) value: (field_access object: (identifier) field: (identifier))))) (expression_statement (assignment_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: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (integral_type) value: (field_access object: (identifier) field: (identifier))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (integral_type) value: (field_access object: (identifier) field: (identifier))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier) (identifier) (identifier)))))))) (while_statement condition: (parenthesized_expression (unary_expression operand: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (field_access object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) field: (identifier)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (field_access object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) field: (identifier)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (parenthesized_expression (ternary_expression condition: (binary_expression left: (identifier) right: (field_access object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) field: (identifier))) consequence: (decimal_integer_literal) alternative: (update_expression (identifier)))) right: (string_literal))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))