1 #include<iostream>
2 #include<cstdio>
3 #include<queue>
4 using namespace std;
5 int tot=0;
6 void ha1(int n,char a,char c,char b)
7 {
8 if(n==0)return;
9 ha1(n-1,a,b,c);
10 tot++;
11 ha1(n-1,b,c,a);
12 }
13 void ha2(int n,char a,char c,char b)
14 {
15 if(n==0)return;
16 ha2(n-1,a,b,c);
17 tot++;
18 cout<<n<<" from"<<" "<<(char)(a-32)<<" "<<"to"<<" "<<(char)(c-32)<<" "<<endl;
19 ha2(n-1,b,c,a);
20 }
21 int main()
22 {
23 int n;
24 cin>>n;
25 ha1(n,'a','c','b');
26 cout<<tot<<endl;
27 tot=0;
28 ha2(n,'a','c','b');
29 return 0;
30 }