public static void main ( String [ ] args ) {
  Scanner scan = new Scanner ( System . in ) ;
  int Q = scan . nextInt ( ) ;
  while ( Q -- > 0 ) {
    long A = scan . nextLong ( ) ;
    long B = scan . nextLong ( ) ;
    long k = ( A + B ) / ( Math . min ( A , B ) + 1 ) ;
    if ( k <= 1 ) {
      int C = scan . nextInt ( ) - 1 ;
      int D = scan . nextInt ( ) - 1 ;
      String even = ( A >= B ? "A" : "B" ) ;
      String odd = ( A >= B ? "B" : "A" ) ;
      String ans = "" ;
      for ( int i = C ;
      i <= D ;
      ++ i ) {
        if ( i % 2 == 0 ) ans += even ;
        else ans += odd ;
      }
      System . out . println ( ans ) ;
      continue ;
    }
    long n = ( k * A - B ) / ( k * k - 1 ) ;
    long m = ( k * B - A ) / ( k * k - 1 ) ;
    long a = A - n * k - m ;
    long b = B - m * k - n ;
    int C = scan . nextInt ( ) - 1 ;
    int D = scan . nextInt ( ) - 1 ;
    String ans = "" ;
    for ( int i = C ;
    i <= D ;
    ++ i ) {
      if ( i < n * ( k + 1 ) ) {
        if ( ( i + 1 ) % ( k + 1 ) == 0 ) ans += "B" ;
        else ans += "A" ;
      }
      else if ( i >= n * ( k + 1 ) + a + b ) {
        long index = i - ( n * ( k + 1 ) ) - a - b ;
        if ( index % ( k + 1 ) == 0 ) ans += "A" ;
        else ans += "B" ;
      }
      else {
        long index = i - n * ( k + 1 ) ;
        if ( index < a ) ans += "A" ;
        else ans += "B" ;
      }
    }
    System . out . println ( ans ) ;
  }
}

public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int Q = scan . nextInt ( ) ; while ( Q -- > 0 ) { long A = scan . nextLong ( ) ; long B = scan . nextLong ( ) ; long k = ( A + B ) / ( Math . min ( A , B ) + 1 ) ; if ( k <= 1 ) { int C = scan . nextInt ( ) - 1 ; int D = scan . nextInt ( ) - 1 ; String even = ( A >= B ? " A " : " B " ) ; String odd = ( A >= B ? " B " : " A " ) ; String ans = " " ; for ( int i = C ; i <= D ; ++ i ) { if ( i % 2 == 0 ) ans += even ; else ans += odd ; } System . out . println ( ans ) ; continue ; } long n = ( k * A - B ) / ( k * k - 1 ) ; long m = ( k * B - A ) / ( k * k - 1 ) ; long a = A - n * k - m ; long b = B - m * k - n ; int C = scan . nextInt ( ) - 1 ; int D = scan . nextInt ( ) - 1 ; String ans = " " ; for ( int i = C ; i <= D ; ++ i ) { if ( i < n * ( k + 1 ) ) { if ( ( i + 1 ) % ( k + 1 ) == 0 ) ans += " B " ; else ans += " A " ; } else if ( i >= n * ( k + 1 ) + a + b ) { long index = i - ( n * ( k + 1 ) ) - a - b ; if ( index % ( k + 1 ) == 0 ) ans += " A " ; else ans += " B " ; } else { long index = i - n * ( k + 1 ) ; if ( index < a ) ans += " A " ; else ans += " B " ; } } System . out . println ( ans ) ; } }
(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: (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: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))) right: (decimal_integer_literal)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (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)))) (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)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (parenthesized_expression (ternary_expression condition: (binary_expression left: (identifier) right: (identifier)) consequence: (string_literal) alternative: (string_literal))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (parenthesized_expression (ternary_expression condition: (binary_expression left: (identifier) right: (identifier)) consequence: (string_literal) alternative: (string_literal))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (string_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (identifier))) alternative: (expression_statement (assignment_expression left: (identifier) right: (identifier)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))) (continue_statement))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier))) right: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier))) right: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))) right: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))) right: (identifier)))) (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)))) (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)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (string_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (string_literal))) alternative: (expression_statement (assignment_expression left: (identifier) right: (string_literal))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (identifier)) right: (identifier)))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))))) right: (identifier)) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (string_literal))) alternative: (expression_statement (assignment_expression left: (identifier) right: (string_literal))))) alternative: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (expression_statement (assignment_expression left: (identifier) right: (string_literal))) alternative: (expression_statement (assignment_expression left: (identifier) right: (string_literal))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))))