def chk(target):
l=1
r=P
cnt=0
while True:
c=(l+r)//2
if c==target:
break
elif c>target:
r=c
cnt+=1
else:
l=c
cnt+=1
return cnt
for tc in range(1,int(input())+1):
P,A,B = map(int,input().split())
aa=chk(A)
bb=chk(B)
if aa<bb:
res='A'
elif aa==bb:
res=0
else:
res='B'
print(f'#{tc} {res}')
텍스트