#include<iostream>
#include<conio.h>
using namespace std;
//tabee
//disk ha az mileye Mil1 be mileye Mil2 be komake Mil3 jabeja shavand.
void Hanoi (int d, int Mil1, int Mil2, int Mil3)
{
	if (d == 1)
		cout << "1 disk az mileye " << Mil1 << " be mileye " << Mil2 << endl;
	else
	{
		Hanoi (d-1, Mil1, Mil3, Mil2);
		cout << "1 disk az mileye " << Mil1 << " be mileye " << Mil2 << endl;
		Hanoi (d-1, Mil3, Mil2, Mil1);
	}
}

int main ()
{
	int DiskNums;
	cout << endl << "Tedade Disk = ";
	cin >> DiskNums;
	if(DiskNums == 1)
		cout << "disk az mileye 1 be mileye 2" << endl;
	else
	{
		Hanoi(DiskNums - 1, 1, 3, 2);
		Hanoi(1, 1, 2, 3);
		Hanoi(DiskNums - 1, 3, 2, 1);
	}
	getch();
}

