/*------------------------------------------------------------
TEAM14
A
238
Target: Java6; Platform: Win32; Comment: Java (JDK 6)
------------------------------------------------------------*/
import java.util.*;
import java.io.*;

public class RandomBot
{
	public static void main(String[] argv) throws IOException
	{
		new RandomBot().run();
	}
	
	Scanner in;
	PrintWriter out;

	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;
		}
	}

	Cell board[][] = new Cell[BOARD_SIZE][BOARD_SIZE];
	Cell currentColor;
	Random random;
	
	ArrayList<GameMove> ar = new ArrayList<GameMove>();

	public class GameMove{
		int sx, sy, ex, ey;
		boolean is_capture;
		GameMove(String move){
			sx = (int)move.charAt(1) - '1';
			sy = (int)move.charAt(0) - 'a';
			ex = (int)move.charAt(3) - '1';
			ey = (int)move.charAt(2) - 'a';
			is_capture = (board[ex][ey] != Cell.EMPTY);
		}
		public String toString(){
			return  String.valueOf((char)(sy+'a')) + String.valueOf(sx+1) +
					String.valueOf((char)(ey+'a')) + String.valueOf(ex+1);
		}
		GameMove(int _sx, int _sy, int _ex, int _ey){
			sx = _sx;
			sy = _sy;
			ex = _ex;
			ey = _ey;
			is_capture = (board[ex][ey] != Cell.EMPTY);
		}
	}

	public boolean validForMove(int x, int y){
		return (x>=0 && x<BOARD_SIZE && y>=0 && y<BOARD_SIZE && board[x][y] != currentColor);
	}
	
	public boolean validS(int x, int y){
		return (x>=0 && x<BOARD_SIZE && y>=0 && y<BOARD_SIZE && board[x][y] == Cell.opposite(currentColor));
	}

	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(314159265358L);
	}

	private void makeMove(GameMove move){
		board[move.ex][move.ey] = board[move.sx][move.sy];
		board[move.sx][move.sy] = Cell.EMPTY;
		currentColor = Cell.opposite(currentColor);
	}

/*	private ArrayList<GameMove> genMoves(){
		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] == currentColor){
					for (int dj=-1; dj<=1; dj++){
						int ni = i + ((currentColor == Cell.WHITE) ? 1 : -1);
						int nj = j + dj;
						if (validForMove(ni, nj) && (dj != 0 || board[ni][nj] == Cell.EMPTY)){
							moves.add(new GameMove(i,j,ni,nj));
						}
					}
				}
			}
		}
		return moves;
	}*/
	
	private ArrayList<GameMove> genS(){
		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] == currentColor){
					for (int dj=-1; dj<=1; dj++){
						int ni = i + ((currentColor == Cell.WHITE) ? 1 : -1);
						int nj = j + dj;
						if (validS(ni, nj) && (dj != 0 || board[ni][nj] == Cell.EMPTY)){
							moves.add(new GameMove(i,j,ni,nj));
						}
					}
				}
			}
		}
		return moves;
	}
	
	private int[] countV(){
		int[] t = new int[BOARD_SIZE];
		for (int i=0; i<BOARD_SIZE; i++){
			for (int j=0; j<BOARD_SIZE; j++){
				if (board[j][i] == currentColor){
					t[i] ++;
				}
			}
		}
		return t;
	}
	
	private void genWin(){
		for (int i=0; i<BOARD_SIZE-1; i++){
			for (int j=0; j<BOARD_SIZE; j++){
				if (board[i][j] == currentColor){
					if (currentColor == Cell.WHITE)
					{
						if (i == 6)
						{
							if (validForMove(7, j-1))
							{
								ar.add(new GameMove(i,j, 7,j-1));
								return;
							}
							else
							{
								ar.add(new GameMove(i,j, 7,j+1));
								return;
							}
								
						}
						boolean c = true;
						for (int k = i+1; k<BOARD_SIZE; k++)
						{
							for (int l = j-k+i+1; l <=j+k-i-1; l++)
							{
								if (validForMove(k, l) && board[k][l] == Cell.BLACK)
								{
									c = false;
									break;
								}
							}
							if (!c)
								break;
						}
						if (c)
						{
							ar.add(new GameMove(i, j, i+1, j));
							return;
						}
						//------------
						c = true;
						for (int k = i+1; k<BOARD_SIZE; k++)
						{
							for (int l = j; l <=j+k-i-1; l++)
							{
								if (validForMove(k, l) && ((k-i) % 2 == 0) && ((l-j) % 2 == 0) && board[k][l] == Cell.BLACK)
								{
									c = false;
									break;
								}
							}
							if (!c)
								break;
						}
						if (c)
						{
								if (validForMove(i+1, j + 1))
								{
									ar.add(new GameMove(i, j, i+1, j + 1));
									return;
								}
						}
						//------------
						c = true;
						for (int k = i+1; k<BOARD_SIZE; k++)
						{
							for (int l = j-k+i+1; l <=j; l++)
							{
								if (validForMove(k, l) && ((k-i) % 2 == 0) && ((l-j) % 2 == 0) && board[k][l] == Cell.BLACK)
								{
									c = false;
									break;
								}
							}
							if (!c)
								break;
						}
						if (c)
						{
							if (validForMove(i+1, j - 1))
							{
								ar.add(new GameMove(i, j, i+1, j-1));
							return;
							}
						}
					}
					else
					{
						if (i == 1)
						{
							if (validForMove(0, j-1))
							{
								ar.add(new GameMove(i,j, 0,j-1));
								return;
							}
							else
							{
								ar.add(new GameMove(i,j, 0,j+1));
								return;
							}
								
						}
						boolean c = true;
						for (int k = i-1; k>=0; k--)
						{
							for (int l = j-k+i-1; l <=j+k-i+1; l++)
							{
								if (validForMove(k, l) && board[k][l] == Cell.WHITE)
								{
									c = false;
									break;
								}
							}
							if (!c)
								break;
						}
						if (c)
						{
							ar.add(new GameMove(i, j, i-1, j));
							return;
						}
						//------------
						c = true;
						for (int k = i-1; k>=0; k--)
						{
							for (int l = j; l <=j+k-i+1; l++)
							{
								if (validForMove(k, l) && ((k-i) % 2 == 0) && ((l-j) % 2 == 0) && board[k][l] == Cell.WHITE)
								{
									c = false;
									break;
								}
							}
							if (!c)
								break;
						}
						if (c)
						{
								if (validForMove(i-1, j + 1))
								{
									ar.add(new GameMove(i, j, i-1, j + 1));
									return;
								}
						}
						//------------
						c = true;
						for (int k = i-1; k>=0; k--)
						{
							for (int l = j-k+i-1; l <=j; l++)
							{
								if (validForMove(k, l) && ((k-i) % 2 == 0) && ((l-j) % 2 == 0) && board[k][l] == Cell.WHITE)
								{
									c = false;
									break;
								}
							}
							if (!c)
								break;
						}
						if (c)
						{
							if (validForMove(i-1, j - 1))
							{
								ar.add(new GameMove(i, j, i-1, j-1));
							return;
							}
						}
					}
				}
			}
		}
	}

	private GameMove getNextMove(){
		int[] t = countV();
//		ArrayList<GameMove> moves = genMoves();
		if (ar.size() == 0)
			genWin();
		
		ArrayList<GameMove> s = genS();
		if (s.size() != 0)
		{
			GameMove move = s.get(random.nextInt(s.size()));
			makeMove(move);
			return move;
		}
		else
		{
			if (ar.size() != 0 && board[ar.get(0).sx][ar.get(0).sy] == currentColor && validForMove(ar.get(0).ex, ar.get(0).ey))
			{
				GameMove move = ar.get(0);
				makeMove(move);
				ar.remove(0);
				return move;
			
			}
		else
		{
			ar = new ArrayList<GameMove>();
			if (currentColor == Cell.WHITE)
			{
				GameMove move = null;
				for (int i=0; i<BOARD_SIZE-1; i++){
					for (int j=0; j<BOARD_SIZE; j++){
						if (board[i][j] == currentColor){
							if (j==0)
							{
								if (board[i+1][j]==Cell.EMPTY)
								{
									if (board[i+1][j+1]==Cell.EMPTY)
									{
										if (t[j]<t[j+1])
										{
											 move = new GameMove(i, j, i+1, j);
											 makeMove(move);
											 return move;

										}
										else
										{
											 move = new GameMove(i, j, i+1, j+1);
											 makeMove(move);
											 return move;

										}
									}
									else
									{
										 move = new GameMove(i, j, i+1, j);
										 makeMove(move);
										 return move;

									}
								}
								else
								{
									if (board[i+1][j+1]==Cell.EMPTY)
									{
										 move = new GameMove(i, j, i+1, j+1);
										 makeMove(move);
										 return move;

									}
								}
							
							}
							else
							{
								if (j==7)
								{
									if (board[i+1][j]==Cell.EMPTY)
									{
										if (board[i+1][j-1]==Cell.EMPTY)
										{
											if (t[j]<t[j-1])
											{
												 move = new GameMove(i, j, i+1, j);
												 makeMove(move);
												 return move;

											}
											else
											{
												 move = new GameMove(i, j, i+1, j-1);
												 makeMove(move);
												 return move;

											}
										}
										else
										{
											 move = new GameMove(i, j, i+1, j);
											 makeMove(move);
											 return move;

										}
									}
									else
									{
										if (board[i+1][j-1]==Cell.EMPTY)
										{
											 move = new GameMove(i, j, i+1, j-1);
											 makeMove(move);
											 return move;
}
									}
								
								}
								else
								{
									if (t[j-1]<t[j] && t[j-1]<t[j+1])
									{
										if (board[i+1][j-1] == Cell.EMPTY)
										{
											 move = new GameMove(i, j, i+1, j-1);
											 makeMove(move);
											 return move;
}
									}
									else
									{
										if (t[j]<=t[j-1] && t[j]<t[j+1])
										{
											if (board[i+1][j] == Cell.EMPTY)
											{
												 move = new GameMove(i, j, i+1, j);
												 makeMove(move);
												 return move;

											}
										}
										else
										{
											if (t[j+1]<=t[j] && t[j+1]<=t[j])
											{
												if (board[i+1][j+1] == Cell.EMPTY)
												{
													 move = new GameMove(i, j, i+1, j+1);
													 makeMove(move);
													 return move;
												}
											}

										}
										
									}
								}
								
							}
							
						}
					}
				}
				 makeMove(move);
				 return move;

				
			}
			else
			{
				GameMove move = null;
				for (int i=BOARD_SIZE-1; i>0; i--){
					for (int j=BOARD_SIZE-1; j>=0; j--){
						if (board[i][j] == currentColor){
							if (j==0)
							{
								if (board[i-1][j]==Cell.EMPTY)
								{
									if (board[i-1][j+1]==Cell.EMPTY)
									{
										if (t[j]<t[j+1])
										{
											 move = new GameMove(i, j, i-1, j);
												makeMove(move);
												return move;

										}
										else
										{
											 move = new GameMove(i, j, i-1, j+1);
												makeMove(move);
												return move;

										}
									}
									else
									{
										 move = new GameMove(i, j, i-1, j);
											makeMove(move);
											return move;

									}
								}
								else
								{
									if (board[i-1][j+1]==Cell.EMPTY)
									{
										 move = new GameMove(i, j, i-1, j+1);
											makeMove(move);
											return move;

									}
								}
							
							}
							else
							{
								if (j==7)
								{
									if (board[i-1][j]==Cell.EMPTY)
									{
										if (board[i-1][j-1]==Cell.EMPTY)
										{
											if (t[j]<t[j-1])
											{
												 move = new GameMove(i, j, i-1, j);
													makeMove(move);
													return move;

											}
											else
											{
												 move = new GameMove(i, j, i-1, j-1);
													makeMove(move);
													return move;

											}
										}
										else
										{
											 move = new GameMove(i, j, i-1, j);
												makeMove(move);
												return move;

										}
									}
									else
									{
										if (board[i-1][j-1]==Cell.EMPTY)
										{
											 move = new GameMove(i, j, i-1, j-1);
												makeMove(move);
												return move;

										}
									}
								
								}
								else
								{
									if (t[j-1]<t[j] && t[j-1]<t[j+1])
									{
										if (board[i-1][j-1] == Cell.EMPTY)
										{
											 move = new GameMove(i, j, i-1, j-1);
												makeMove(move);
												return move;

										}
									}
									else
									{
										if (t[j]<=t[j-1] && t[j]<t[j+1])
										{
											if (board[i-1][j] == Cell.EMPTY)
											{
												 move = new GameMove(i, j, i-1, j);
													makeMove(move);
													return move;

											}
										}
										else
										{
											if (t[j+1]<=t[j] && t[j+1]<=t[j])
											{
												if (board[i-1][j+1] == Cell.EMPTY)
												{
													 move = new GameMove(i, j, i-1, j+1);
														makeMove(move);
														return move;

												}
											}

										}
										
									}
								}
								
							}
							
						}
					}
				}
				makeMove(move);
				return move;
				
			}
		}
		}
	}

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

		initBoard();
		while (true){
			String theirMove = in.nextLine();
			if (theirMove.equals("Name")){
				out.println("OSPU1");
				out.flush();
			}
			else if (theirMove.equals("Quit")){
				return;
			}
			else{
				if (!theirMove.equals("Start")){
					makeMove(new GameMove(theirMove));
				}
				out.println(getNextMove().toString());
				out.flush();
			}
		}
	}
}
