#include<stdio.h>
#define _CRT_SECURE_NO_WARNINGS 1
void hannuo(int n, char a, char b, char c);
int main()
{
int n = 0;
scanf("%d", &n);
getchar();
char a, b, c;
scanf("%c %c %c", &a, &b, &c);
hannuo(n,a, b, c);
return 0;
}
void hannuo(int n,char a,char b,char c)
{
if (n == 1)
printf("%d:%c->%c\n",n,a,c);
else
{
hannuo(n - 1, a, c, b);
printf("%d:%c->%c\n",n,a,c);//盘子由a通过c送到b,打印这一过程
hannuo(n - 1, b, a, c);
}
}