#include<bits/stdc++.h>
using namespace std;
void hnt(int s,char q,char c,char z){
if(s==1) cout<<q<<" To "<<z<<endl;
else{
hnt(s-1,q,z,c);
cout<<q<<" To "<<z<<endl;
hnt(s-1,c,q,z);
}
}
int main(){
int n;
cin>>n;
hnt(n,'A','B','C');
return 0;
}
/**************************************************************
Problem: 1222
User: hongjiaming
Language: C++
Result: Accepted
Time:8 ms
Memory:2072 kb
****************************************************************/