//
// main.cpp
// a227
//
// Created by Spencer Yao-Yi Huang on 11/17/2019.
// Copyright © 2019 Spencer Yao-Yi Huang. All rights reserved.
//
#include <iostream>
using namespace std;
int f(int n,int s,int t){
if(n==0) return 0;
f(n-1,s,198-s-t);
printf("Move ring %d from %c to %c",n,s,t);
cout<<endl;
f(n-1,198-s-t,t);
return 0;
}
int main(){
int m;
while(cin>>m){
f(m,65,67);
}
}