#include <iostream>
using namespace std;
void move(char a,char b){
cout<<"From "<<a<<" to "<<b<<endl;
}
void nuota(int n,char a,char b,char c){
if(n==1)move(a,c);
else{
nuota(n-1,a,c,b);
move(a,c);
nuota(n-1,b,a,c);
}
}
int main(){
int dish;
cin>>dish;
cout<<"The steps:"<<endl;
nuota(dish,'A','B','C');//借助B将碟子从A移动到C
return 0;
}