#include <stdio.h>
#include <string.h>
#include <stdlib.h>

void hanoi(int n, int from, int temp, int to){
    if(n==1){
        printf("%d %d\n", from, to);
        return;
    }

    hanoi(n-1, from, to, temp);
    printf("%d %d\n", from, to);
    hanoi(n-1, temp, from, to);
    
}

int main(){
	int n;
    scanf("%d", &n);

    printf("%d\n", (1<<n)-1);

    hanoi(n, 1, 2, 3);
    
	return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: