program dvonn;

var white : boolean;
    s : string[10]; { stores the data read from stdin }
    numPlaced : integer;
    x, y, fromX, fromY, toX, toY : integer;

procedure placedPiece(x, y : integer);
begin
  { store the opponents placed piece }
end;

procedure placePiece(var x, y : integer);
begin
  { calculate where to place a piece and store it in the arguments }
end;

procedure movedPiece(fromX, fromY, toX, toY : integer);
begin
  { store the the opponents move }
end;

procedure movePiece(var fromX, fromY, toX, toY : integer);
begin
  { calculate a move and store it in the arguments } 
end;

begin
  white := false;
  numPlaced := 0;
  while true do
  begin
    readln(s);
    if s = 'Quit' then
      halt(0); { Quit the game when we read "Quit" }
    if s = 'Start' then
    begin
      { The first turn, so we're white and go first }
      white := true;
    end else if numPlaced < 49 then
    begin
      x := ord(s[1]) - ord('A');
      y := ord(s[2]) - ord('1');
      placedPiece(x, y); { tell the opponent placed a piece }
      inc(numPlaced);
    end else begin
      fromX := ord(s[1]) - ord('A');
      fromY := ord(s[2]) - ord('1');
      toX := ord(s[3]) - ord('A');
      toY := ord(s[4]) - ord('1');
      movedPiece(fromX, fromY, toX, toY); { tell the opponent moved a piece }
    end;
    
    if numPlaced < 49 then
    begin
      inc(numPlaced);
      placePiece(x, y); { ask to place a piece }
      s[1] := chr(x + ord('A'));
      s[2] := chr(y + ord('1'));
      writeln(s[1], s[2]); { output the move }
      flush(output); { flush the output (very important) }
    end;
    if numPlaced >= 49 then
    begin
      movePiece(fromX, fromY, toX, toY); { ask to move a piece }
      s[1] := chr(fromX + ord('A'));
      s[2] := chr(fromY + ord('1'));
      s[3] := chr(toX + ord('A'));
      s[4] := chr(toY + ord('1'));
      writeln(s[1], s[2], s[3], s[4]); { output the move }
      flush(output); { flus the output (very important) }
    end;
  end;
end.


syntax highlighted by Code2HTML, v. 0.9.1