#include <stdio.h>
void hanoi(int n, int A, int B, int C) {
if (n == 1) {
printf("Chuyen dia 1 tu cot %d sang cot %d\n", A, C);
return;
}
hanoi(n-1, A, C, B);
printf("Chuyen dia %d tu cot %d sang cot %d\n", n, A, C);
hanoi(n-1, B, A, C);
}
int main() {
int n;
scanf("%d", &n);
hanoi(n, 1, 2, 3);
return 0;
}