def hannuo(x,a,b,c): if x == 1: print(a,"->",c) else: hannuo(x-1,a,c,b) print(a,"->",c) hannuo(x-1,b,a,c) x = int(input()) hannuo(x,"A","B","C")