#include <stdio.h>

void moveOneDisk(int from, int to){
    printf("杭%dから杭%dに移動\n", from, to);
}

void moveDisks(int from, int to, int n){
    int anotherPole = 6 - (from + to);

    if(n == 1){
        moveOneDisk(from, to);
    } else {
        moveDisks(from, anotherPole, n - 1);
        moveOneDisk(from, to);
        moveDisks(anotherPole, to, n - 1);
    }
}

int main(void) {
    int n = 5;
    printf("%d枚の円盤を杭1から杭3に移動させる手順は以下のとおり:\n", n);
    moveDisks(1, 3, n);
    return 0;
}


