/*
 *  Example of a Caissa player program for the CodeCup.
 *
 *  This only demonstrates how to do the input and output. You will
 *  have to write the algorithms for the game all by yourself.
 *
 *  We use numbers 0..6 to refer to columns A..G,
 *  and numbers 0..6 to refer to rows 1..7.
 */

import java.io.*;


class CodeCup
{

    // Input stream tokenizer
    StreamTokenizer inp;

    // This variable is set to non-zero if we are playing white.
    boolean iAmPlayingWhite;

    // Constructor
    CodeCup()
      throws IOException
    {
        inp = new StreamTokenizer(new InputStreamReader(System.in));
        inp.resetSyntax();
        inp.whitespaceChars(0, 32);
        inp.wordChars(33, 127);
    }

    // This function resets the game board to the initial position.
    void initGameBoard()
    {
        // TODO
    }


    // This function selects the best move for us to make now.
    int[] selectMyBestMove()
    {
        int fromcol = 0, fromrow = 0, tocol = 0, torow = 0;
        // TODO
        return new int[] { fromcol, fromrow, tocol, torow };
    }


    // This function updates the game board with a move from the opponent.
    void doOpponentMove(int fromcol, int fromrow, int tocol, int torow)
    {
        // TODO
    }


    // Game loop
    void run()
      throws IOException
    {
        String buf;
        int fromcol, fromrow, tocol, torow;

        // Set the game board to its initial position
        initGameBoard();

        // Read the first line of input
        inp.nextToken();
        buf = inp.sval;

        // The first line contains 'start' if we are playing white
        if ( buf.equals("start") ) {

            // We are playing white
            iAmPlayingWhite = true;

            // Select our first move
            int[] move = selectMyBestMove();

            // Write our first move
            System.out.println("" +
              (char)('a' + move[0]) + (1 + move[1]) + "-" +
              (char)('a' + move[2]) + (1 + move[3]));
            System.out.flush();

            // Read the next line of input
            inp.nextToken();
            buf = inp.sval;

        } else {

            // We are playing black
            iAmPlayingWhite = false;

        }

        // Repeat this until the end of the game
        while ( ! buf.equals("end") ) {

            // Parse the opponnent's move
            fromcol = buf.charAt(0) - 'a';
            fromrow = buf.charAt(1) - '1';
            tocol = buf.charAt(3) - 'a';
            torow = buf.charAt(4) - '1';

            // Update the game board
            doOpponentMove(fromcol, fromrow, tocol, torow);

            // Select the best move for us
            int[] move = selectMyBestMove();

            // Write the selected move to the output
            System.out.println("" +
              (char)('a' + move[0]) + (1 + move[1]) + "-" +
              (char)('a' + move[2]) + (1 + move[3]));
            System.out.flush();

            // Read the next line of input
            inp.nextToken();
            buf = inp.sval;
        }
    }


    // Main program function called when program starts
    public static void main(String[] args) {
        try {
            CodeCup cc = new CodeCup();
            cc.run();
        } catch (IOException e) {
            System.err.println(e);
        }
    }

}

/* End */

syntax highlighted by Code2HTML, v. 0.9.1