#include<bits/stdc++.h>
using namespace std;
void Tower_Of_Hanoi(int N, char A, char C, char B)
{
if (N == 1)
{
cout<<"Move "<<N<<" from "<<A<<" to "<<C<<endl;
return;
}
Tower_Of_Hanoi(N-1,A,B,C);
cout<<"Move "<<N<<" from "<<A<<" to "<<C<<endl;
Tower_Of_Hanoi(N-1,B,C,A);
}
int main()
{
int N;
cin>>N;
Tower_Of_Hanoi(N,'A','C','B');
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnZvaWQgVG93ZXJfT2ZfSGFub2koaW50IE4sIGNoYXIgQSwgY2hhciBDLCBjaGFyIEIpCnsKICAgIGlmIChOID09IDEpCiAgICB7CiAgICAgICAgY291dDw8Ik1vdmUgIjw8Tjw8IiBmcm9tICI8PEE8PCIgdG8gIjw8Qzw8ZW5kbDsKICAgICAgICByZXR1cm47CiAgICB9CiAgICBUb3dlcl9PZl9IYW5vaShOLTEsQSxCLEMpOwogICAgY291dDw8Ik1vdmUgIjw8Tjw8IiBmcm9tICI8PEE8PCIgdG8gIjw8Qzw8ZW5kbDsKICAgIFRvd2VyX09mX0hhbm9pKE4tMSxCLEMsQSk7Cn0KCgppbnQgbWFpbigpCnsKICAgIGludCBOOwogICAgY2luPj5OOwogICAgVG93ZXJfT2ZfSGFub2koTiwnQScsJ0MnLCdCJyk7CgogICAgcmV0dXJuIDA7Cn0=