import java.util.Scanner;
//汉诺塔
public class Hanoi {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
hanoni(n,'A','B','C');
}
public static void hanoni(int n, char from, char temp, char to) {
// TODO Auto-generated method stub\
if(n == 0) return;
hanoni(n-1,from,to,temp);//n-1������ת
System.out.println(from+"->"+to);//1����Ŀ��
hanoni(n-1,temp,from,to);//n-1������ת��Ŀ��
}
}