/*
Author:Albert Tesla Wizard
Time:2021/7/7 0:15
*/
#include<bits/stdc++.h>
using namespace std;
int cnt=0;
void Move(int n,char ch1,char ch2)
{
cout<<++cnt<<". Move disk "<<n<<" from "<<ch1<<" to "<<ch2<<'\n';
}
void hannuo(int n,char ch1,char ch2,char ch3)
{
if(n==1){Move(1,ch1,ch3);return ;}
else
{
hannuo(n-1,ch1,ch3,ch2);
Move(n,ch1,ch3);
hannuo(n-1,ch2,ch1,ch3);
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n;
while(cin>>n){hannuo(n,'X','Y','Z');cout<<'\n';cnt=0;}
return 0;
}
PS:键入Ctrl+Z结束输入