#include <stdio.h>

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

int main(int argc, char **argv)
{
	int n;

	sscanf(argv[1], "%d", &n);

	hanoi(0, 1, 2, n);

	return 0;
}
