public static void main ( String args [ ] ) {
  FScanner in = new FScanner ( ) ;
  PrintWriter out = new PrintWriter ( System . out ) ;
  int t = in . nextInt ( ) ;
  while ( t -- > 0 ) {
    int n = in . nextInt ( ) ;
    int k1 = in . nextInt ( ) ;
    int k2 = in . nextInt ( ) ;
    int a [ ] = in . readArray ( k1 ) ;
    int b [ ] = in . readArray ( k2 ) ;
    int max1 = Integer . MIN_VALUE ;
    int max2 = Integer . MIN_VALUE ;
    for ( int i = 0 ;
    i < k1 ;
    i ++ ) {
      if ( a [ i ] > max1 ) max1 = a [ i ] ;
    }
    for ( int i = 0 ;
    i < k2 ;
    i ++ ) {
      if ( b [ i ] > max2 ) max2 = b [ i ] ;
    }
    if ( max1 > max2 ) out . println ( "YES" ) ;
    else out . println ( "NO" ) ;
  }
  out . close ( ) ;
}

public static void main ( String args [ ] ) { FScanner in = new FScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int t = in . nextInt ( ) ; while ( t -- > 0 ) { int n = in . nextInt ( ) ; int k1 = in . nextInt ( ) ; int k2 = in . nextInt ( ) ; int a [ ] = in . readArray ( k1 ) ; int b [ ] = in . readArray ( k2 ) ; int max1 = Integer . MIN_VALUE ; int max2 = Integer . MIN_VALUE ; for ( int i = 0 ; i < k1 ; i ++ ) { if ( a [ i ] > max1 ) max1 = a [ i ] ; } for ( int i = 0 ; i < k2 ; i ++ ) { if ( b [ i ] > max2 ) max2 = b [ i ] ; } if ( max1 > max2 ) out . println ( " YES " ) ; else out . println ( " NO " ) ; } out . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (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) dimensions: (dimensions) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (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 (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) consequence: (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (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 (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) consequence: (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) alternative: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))