output_description: For each query i in order of input, print a line containing the substring of
  f(A_i, B_i) from position C_i to position D_i (1-based).
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      Q
      A_1 B_1 C_1 D_1
      A_2 B_2 C_2 D_2
      :
      A_Q B_Q C_Q D_Q
attempt: for t in range(int(input())):
    a,b,c,d=map(int,input().split(' '));l,x,y,o=(a+b)//(min(a,b)+1),0,0,""
  	if a*l<=b:y=a+b
  	elif b*l<=a:x=a+b
  	else:x,y=(a*l-b)//(l-1),(b*l-a)//(l-1)
  	for i in range(c,d+1):o+="AB"[i%(l+1)==0] if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-y//(l+1)==0]
  	print(o)
problem_description: Statement
  
  Let f(A, B), where A and B are positive integers, be the string satisfying the
  following conditions:
  
    * f(A, B) has length A + B;
    * f(A, B) contains exactly A letters `A` and exactly B letters `B`;
    * The length of the longest substring of f(A, B) consisting of equal letters (ex., `AAAAA` or `BBBB`) is as small as possible under the conditions above;
    * f(A, B) is the lexicographically smallest string satisfying the conditions above.
  
  For example, f(2, 3) = `BABAB`, and f(6, 4) = `AABAABAABB`.
  
  Answer Q queries: find the substring of f(A_i, B_i) from position C_i to
  position D_i (1-based).
samples: [{"input": "5\n    2 3 1 5\n    6 4 1 10\n    2 3 4 4\n    6 4 3 7\n    8 10 5 8", "output": "BABAB\n    AABAABAABB\n    A\n    BAABA\n    ABAB"}]