#include<stdio.h> void hanio(int n,char a,char b,char c) { if(n==1) printf("%c->%c\n",a,c); else{ hanio(n-1,a,c,b); printf("%c->%c\n",a,c); hanio(n-1,b,a,c); } } int main(void) { int n; n>=1&&n<=10; while(scanf("%d",&n)!=EOF){ hanio(n,'a','b','c');} return 0; }