{$T-}
program TOWERS_OF_HANOI;
var N:INTEGER;

procedure MOVETOWER(M,A,B,C: INTEGER);

procedure MOVEDISK(FROM,TO: INTEGER);
const NL=CHR(10);
begin
  WRITE(OUT,'move disk from ',FROM,' to ',TO,NL)
end {MOVEDISK};
begin
if M=1
then MOVEDISK(A,C)
else begin
  MOVETOWER(M-1,A,C,B);
  MOVEDISK(A,C);
  MOVETOWER(M-1,B,A,C)
  end;
end {MOVETOWER};

begin
WRITE(OUT,'enter N:'); BREAK(OUT); READ(INP,N);
MOVETOWER(N,1,2,3);
WRITE(OUT,'I AM DONE....'); BREAK(OUT)
end.
