def hanioStep(n, a , b , c):
if (n==1):
print("Move disk {} from {} to {}".format(n,a,c))
else:
hanioStep(n-1,a,c,b)
print("Move disk {} from {} to {}".format(n, a, c))
hanioStep(n - 1, b, a, c)
if __name__ == '__main__':
n = int(input())
hanioStep(n,'A','B','C')