public static void main ( String [ ] args ) {
  Scanner input = new Scanner ( System . in ) ;
  int t = input . nextInt ( ) ;
  while ( t -- > 0 ) {
    int a = input . nextInt ( ) ;
    String s = input . next ( ) ;
    int n = 0 ;
    for ( int i = s . length ( ) - 1 ;
    i > - 1 ;
    i -- ) {
      char c = s . charAt ( i ) ;
      if ( c == ')' ) {
        n ++ ;
        if ( n == s . length ( ) ) {
          System . out . println ( "Yes" ) ;
        }
      }
      else {
        if ( n > s . length ( ) - n ) {
          System . out . println ( "Yes" ) ;
          break ;
        }
        else {
          System . out . println ( "No" ) ;
          break ;
        }
      }
    }
  }
}

public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int t = input . nextInt ( ) ; while ( t -- > 0 ) { int a = input . nextInt ( ) ; String s = input . next ( ) ; int n = 0 ; for ( int i = s . length ( ) - 1 ; i > - 1 ; i -- ) { char c = s . charAt ( i ) ; if ( c == ' ) ' ) { n ++ ; if ( n == s . length ( ) ) { System . out . println ( " Yes " ) ; } } else { if ( n > s . length ( ) - n ) { System . out . println ( " Yes " ) ; break ; } else { System . out . println ( " No " ) ; break ; } } } } }
(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: (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: (type_identifier) 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))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (unary_expression operand: (decimal_integer_literal))) 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 (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (character_literal))) consequence: (block (expression_statement (update_expression (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))))) alternative: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (identifier)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (break_statement)) alternative: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (break_statement)))))))))))