public static void main ( String [ ] args ) throws Throwable {
  BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ;
  PrintWriter pw = new PrintWriter ( System . out , true ) ;
  Scanner sc = new Scanner ( System . in ) ;
  int t = sc . nextInt ( ) ;
  while ( t -- > 0 ) {
    int n = sc . nextInt ( ) ;
    int min = 1 , max = n ;
    if ( n > 1 ) {
      pw . printf ( "? %d %d\n" , 1 , n ) ;
      pw . flush ( ) ;
      char c = sc . next ( ) . charAt ( 0 ) ;
      if ( c == '>' ) {
        min = n ;
        max = 1 ;
      }
      int s = 2 , e = n - 1 ;
      while ( s <= e ) {
        int min1 = s , max1 = e ;
        if ( s != e ) {
          pw . printf ( "? %d %d\n" , s , e ) ;
          pw . flush ( ) ;
          c = sc . next ( ) . charAt ( 0 ) ;
          if ( c == '>' ) {
            min1 = e ;
            max1 = s ;
          }
        }
        pw . printf ( "? %d %d\n" , min1 , min ) ;
        pw . flush ( ) ;
        c = sc . next ( ) . charAt ( 0 ) ;
        if ( c == '<' ) min = min1 ;
        pw . printf ( "? %d %d\n" , max1 , max ) ;
        pw . flush ( ) ;
        c = sc . next ( ) . charAt ( 0 ) ;
        if ( c == '>' ) max = max1 ;
        s ++ ;
        e -- ;
      }
    }
    pw . printf ( "! %d %d\n" , min , max ) ;
    pw . flush ( ) ;
  }
  pw . flush ( ) ;
  pw . close ( ) ;
}

public static void main ( String [ ] args ) throws Throwable { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out , true ) ; Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int min = 1 , max = n ; if ( n > 1 ) { pw . printf ( " ? ▁ % d ▁ % d \n " , 1 , n ) ; pw . flush ( ) ; char c = sc . next ( ) . charAt ( 0 ) ; if ( c == ' > ' ) { min = n ; max = 1 ; } int s = 2 , e = n - 1 ; while ( s <= e ) { int min1 = s , max1 = e ; if ( s != e ) { pw . printf ( " ? ▁ % d ▁ % d \n " , s , e ) ; pw . flush ( ) ; c = sc . next ( ) . charAt ( 0 ) ; if ( c == ' > ' ) { min1 = e ; max1 = s ; } } pw . printf ( " ? ▁ % d ▁ % d \n " , min1 , min ) ; pw . flush ( ) ; c = sc . next ( ) . charAt ( 0 ) ; if ( c == ' < ' ) min = min1 ; pw . printf ( " ? ▁ % d ▁ % d \n " , max1 , max ) ; pw . flush ( ) ; c = sc . next ( ) . charAt ( 0 ) ; if ( c == ' > ' ) max = max1 ; s ++ ; e -- ; } } pw . printf ( " ! ▁ % d ▁ % d \n " , min , max ) ; pw . flush ( ) ; } pw . flush ( ) ; pw . 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 (field_access object: (identifier) field: (identifier)))))))) (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)) (true))))) (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)))) (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: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal) (decimal_integer_literal) (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (character_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier)) declarator: (variable_declarator name: (identifier) value: (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal) (identifier) (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (character_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal) (identifier) (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (character_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal) (identifier) (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (character_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (identifier)))) (expression_statement (update_expression (identifier))) (expression_statement (update_expression (identifier))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal) (identifier) (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)))))