/*------------------------------------------------------------
TEAM31
A
199
Target: Java6; Platform: Win32; Comment: Java (JDK 6)
------------------------------------------------------------*/
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class RandomBot
{
	public static void main(String[] argv) throws IOException
	{
		if (doDump)
			movesOut = new PrintWriter("dump.txt");
		new RandomBot().run();
		
		if (doDump)
			movesOut.close();
	}
	
	Scanner in;
	PrintWriter out;
	static PrintWriter movesOut;

	public static final int BOARD_SIZE = 8;

	public static enum Cell{
		EMPTY, WHITE, BLACK;
		public static Cell opposite(Cell cell){
			return (cell == WHITE) ? BLACK : WHITE;
		}
	}
	
	static boolean doDump = false;

	Cell board[][] = new Cell[BOARD_SIZE][BOARD_SIZE];
	//Cell currentColor;
	Random random;

	Cell ourColor = Cell.BLACK;
	
	double NUMBER_DIFFERENCE = 30;
	double OUR_UNDER_ATTACK = 20;
	double DISTANCE_ESTIMATION = 1;
	double EQUALITY_TRESHOLD = 5;
	
	public class GameMove implements Comparable<GameMove>{
		double estimation;
		int sR, sC, eR, eC;
		boolean is_capture;
		GameMove(String move){
			sR = (int)move.charAt(1) - '1';
			sC = (int)move.charAt(0) - 'a';
			eR = (int)move.charAt(3) - '1';
			eC = (int)move.charAt(2) - 'a';
			is_capture = (board[eR][eC] != Cell.EMPTY);
		}
		public String toString(){
			return  String.valueOf((char)(sC+'a')) + String.valueOf(sR+1) +
					String.valueOf((char)(eC+'a')) + String.valueOf(eR+1);
		}
		GameMove(int _sx, int _sy, int _ex, int _ey){
			sR = _sx;
			sC = _sy;
			eR = _ex;
			eC = _ey;
			is_capture = (board[eR][eC] != Cell.EMPTY);
		}
		
		public int compareTo(GameMove other) {
			if (estimation < other.estimation) {
				return -1;
			}
			if (estimation > other.estimation) {
				return 1;
			}
			return 0;
		}
	}

	public boolean validForMove(int r, int c, Cell[][] board, Cell color){
		return (r>=0 && r<BOARD_SIZE && c>=0 && c<BOARD_SIZE && board[r][c] != color);
	}

	private void initBoard(){
		board = new Cell[BOARD_SIZE][BOARD_SIZE];
		for (int i=0; i<BOARD_SIZE; i++){
			for (int j=0; j<BOARD_SIZE; j++){
				if (i <= 1) board[i][j] = Cell.WHITE;
				else if (i >= BOARD_SIZE-2) board[i][j] = Cell.BLACK;
				else board[i][j] = Cell.EMPTY;
			}
		}
		//currentColor = Cell.WHITE;
		random = new Random(315149265358L);
	}

	private void makeMove(GameMove move){
		board[move.eR][move.eC] = board[move.sR][move.sC];
		board[move.sR][move.sC] = Cell.EMPTY;
		//currentColor = Cell.opposite(currentColor);
	}
	
	Cell[][] makeMove(Cell[][] board, GameMove move) {
		Cell[][] newBoard = new Cell[BOARD_SIZE][BOARD_SIZE];
		for (int r = 0; r < BOARD_SIZE; r++) {
			for (int c = 0; c < BOARD_SIZE; c++) {
				newBoard[r][c] = board[r][c];
			}
		}
		
		makeMove(move);
		
		Cell[][] temp = newBoard;
		newBoard = this.board;
		this.board = temp;
		
		return newBoard;
	}

	private ArrayList<GameMove> genMoves(Cell[][] board, Cell color){
		ArrayList<GameMove> moves = new ArrayList<GameMove>();
		for (int i=0; i<BOARD_SIZE; i++){
			for (int j=0; j<BOARD_SIZE; j++){
				if (board[i][j] == color){
					for (int dj=-1; dj<=1; dj++){
						int ni = i + ((color == Cell.WHITE) ? 1 : -1);
						int nj = j + dj;
						if (validForMove(ni, nj, board, color) && (dj != 0 || board[ni][nj] == Cell.EMPTY)){
							moves.add(new GameMove(i,j,ni,nj));
						}
					}
				}
			}
		}
		return moves;
	}

	private GameMove getNextMove(){
		int[] minMovesForUs = getMinimumToEnd(ourColor);
		int[] minMovesForEnemy = getMinimumToEnd(Cell.opposite(ourColor));
		
		GameMove move = null;
		
		if (minMovesForUs[0] != Integer.MAX_VALUE && minMovesForUs[0] <= minMovesForEnemy[0]) {
			move = getAvailableMove(minMovesForUs[1], minMovesForUs[2]);
		}
		
		if (move == null) {
			move = getOptimalMove();
		}
		
		makeMove(move);
		return move;
	}
	
	GameMove getOptimalMove() {
		GameMove bestMove = null;
		
		ArrayList<GameMove> moves = genMoves(board, ourColor);
		
		for (int i = 0; i < moves.size(); i++) {
			GameMove move = moves.get(i);
			Cell[][] board = makeMove(this.board, move);
			move.estimation = esitmateState(board, ourColor);
		}
		
		Collections.sort(moves);
		
		for (int i = 0; i < moves.size(); i++) {
			if (moves.get(i).estimation + EQUALITY_TRESHOLD >= moves.get(moves.size() - 1).estimation) {
				int index = i + random.nextInt(moves.size() - i);
				bestMove = moves.get(index);
				break;
			}
		}
		
		return bestMove;
	}
	
	GameMove getAvailableMove(int r, int c) {
		int er = r + (board[r][c] == Cell.WHITE ? +1 : -1);
		int ec = -1;
		for (int d = -1; d <= 1; d++) {
			if (inBoardAndEmpty(er, c + d) || (d != 0 && isAvailableForMove(er, c + d, board[r][c]))) {
				ec = c + d;
				break;
			}
		}
		if (ec == -1) {
			return null;
		} else {
			return new GameMove(r, c, er, ec);
		}
	}
	
	boolean isAvailableForMove(int r, int c, Cell color) {
		return r >= 0 && r < BOARD_SIZE && c >= 0 && c < BOARD_SIZE && board[r][c] != color;
	}
	
	boolean inBoardAndEmpty(int r, int c) {
		return r >= 0 && r < BOARD_SIZE && c >= 0 && c < BOARD_SIZE && board[r][c] == Cell.EMPTY;
	}
	
	boolean hasEnemy(int r, int c, Cell color) {
		if (r < 0 || r >= BOARD_SIZE || c < 0 || c >= BOARD_SIZE) {
			return false;
		}
		return board[r][c] == Cell.opposite(color);
	}
	
	int[] getMinimumToEnd(Cell color) {
		int bestR = -1, bestC = -1;
		int res = Integer.MAX_VALUE;
		for (int r = 0; r < BOARD_SIZE; r++) {
			for (int c = 0; c < BOARD_SIZE; c++) {
				if (board[r][c] == color) {
					int limit, delta;
					if (color == Cell.WHITE) {
						limit = 8;
						delta = +1;
					} else {
						limit = -1;
						delta = -1;
					}
					
					boolean ok = true;
					
					for (int i = 1; ok ; i++) {
						int curR = r + i * delta;
						if (curR == limit) {
							break;
						}
						for (int j = 0; j <= i && ok; j++) {
							ok &= (i == 1 && j == 1) || !hasEnemy(curR, c - j, color);
							ok &= (i == 1 && j == 1) || !hasEnemy(curR, c + j, color);
						}
					}
					
					if (ok) {
						int dist = abs(limit - r) - 1;
						if (dist < res) {
							res = dist;
							bestR = r;
							bestC = c;
						}
					}
					
				}
			}
		}

		return new int[] { res, bestR, bestC };
	}
	
	double esitmateState(Cell[][] board, Cell color) {
		double estimation = estimateOne(board, color) - estimateTwo(board, color) + estimateThree(board, color);
		return estimation;
	}
	
	double estimateOne(Cell[][] board, Cell color) {
		int ourFigures = 0;
		int enemyFigures = 0;
		
		for (int r = 0; r < BOARD_SIZE; r++) {
			for (int c = 0; c < BOARD_SIZE; c++) {
				if (board[r][c] == color) {
					ourFigures++;
				} else
					if (board[r][c] == Cell.opposite(color)) {
						enemyFigures++;
					}
			}
		}
		return (ourFigures - enemyFigures) * NUMBER_DIFFERENCE;
	}
	
	double estimateTwo(Cell[][] board, Cell color) {
		int count = 0;
		int delta = color == Cell.WHITE ? +1 : -1;
		for (int r = 0; r < BOARD_SIZE; r++) {
			for (int c = 0; c < BOARD_SIZE; c++) {
				if (board[r][c] == color) {
					for (int i = -1; i <= 1; i += 2) {
						if (hasEnemy(r + delta, c + i, color)) {
							count++;
							break;
						}
					}
				}
			}
		}
		return count * OUR_UNDER_ATTACK;
	}
	
	double estimateThree(Cell[][] board, Cell color) {
		double result = 0;
		for (int r = 0; r < BOARD_SIZE; r++) {
			for (int c = 0; c < BOARD_SIZE; c++) {
				if (board[r][c] == color) {
					double dist = color == Cell.WHITE ? r : 7 - r;
					result += dist * dist;
				}
			}
		}
		return result * DISTANCE_ESTIMATION;
	}
	

	public void run() throws IOException
	{
		in = new Scanner(System.in);
		out = new PrintWriter(System.out);

		initBoard();
		while (true){
			String theirMove = in.nextLine();
			if (doDump)
				movesOut.println(theirMove);
			if (theirMove.equals("Name")){
				out.println("Siberian SUTI");
				out.flush();
			}
			else if (theirMove.equals("Quit")){
				return;
			}
			else{
				if (!theirMove.equals("Start")){
					makeMove(new GameMove(theirMove));
				} else {
					ourColor = Cell.WHITE;
				}
				GameMove ourMove = getNextMove(); 
				out.println(ourMove.toString());
				out.flush();
			}
		}
	}
}
