
public class Towers {

	public static void main(String[] args) {
		towers(4, 1, 3, 2);
	}
	
	public static void towers(int disks, int from, int to, int using) {
		if(disks == 1) {
			System.out.printf("Move a disk from %d to %d.\n", from, to);
		}
		else {
			//recursive part
			//move the top n-1 disks from -> using
			towers(disks-1, from, using, to);
			
			//move the remaining disk from-> to
			towers(1, from, to, using);
			
			//move the disks using ->
			towers(disks-1, using, to, from);
		}
	}

}
