import java.util.*;
public class Han
{
static int count=0;
public static void main(String[] args)
{
Scanner as=new Scanner(System.in);
System.out.println("请输入要移动的盘子数");
int m=as.nextInt();
hanoi(m,'A','B','C');
System.out.println("/n共需要"+count+"步");
}
public static void move(char x,char y)
{
count++;
if(count%6!=0) {
System.out.print(x+"-->"+y+" ");
}else{
System.out.println(x+"-->"+y);
}
}
public static void hanoi(int n,char one,char two,char three)
{
if(n==1)
move(one,three);
else
{
hanoi(n-1,one,three,two);
move(one,three);
hanoi(n-1,two,one,three);
}
}
}