#include<iostream>
using namespace std;
void hannuo(int remained, char from,char mid,char to)
{
if(remained==1)
{
cout<<"从"<<from<<"柱子移到"<<to<<"柱子。\n";
return;
}
hannuo(remained-1,from,to,mid);
cout<<remained<<endl;
hannuo(remained-1,mid,from,to);
}
int main()
{
hannuo(5,'A','B','C');
return 0;
}