N=int(input()) queue={"A":[],"B":[]} for bit in range(1,1<