program pil_12_33(input,output);
type
  towers = 1..3;
var
  n : integer;

procedure HanoyTowers(n : integer; f,t : towers);
var
  m : integer;
begin
  m := 6 - f - t; {the therd disk}
  if n=1 then WriteLn('Move disk from ', chr(ord('A')+f-1), ' to ', chr(ord('A')+t-1))
  else begin
    HanoyTowers(n-1, f, m);
    WriteLn('Move disk from ', chr(ord('A')+f-1), ' to ', chr(ord('A')+t-1));
    HanoyTowers(n-1, m, t);
  end;
end;

begin
  Write('Input number of disks : ');
  Read(n);
  WriteLn('-------SOLVE-------');
  HanoyTowers(n, 1, 2);
end.
