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

public class OurBot
{
	public static void main(String[] argv) throws IOException
	{
		new OurBot().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;

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

	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(System.currentTimeMillis());
	}

	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>();
		ArrayList<GameMove> goodmoves = 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));
							if (currentColor == Cell.WHITE) {
								if (i > 0 || (j == 0 || j == 3 || j == 4 || j == 7)) {
									goodmoves.add(new GameMove(i,j,ni,nj));
								}
							} else if (currentColor == Cell.BLACK) {
								if (i < 7 || (j == 0 || j == 3 || j == 4 || j == 7)) {
									goodmoves.add(new GameMove(i,j,ni,nj));
								}
							}
						}
					}
				}
			}
		}
		if (goodmoves.size() > 0) {
			return goodmoves;
		}
		return moves;
	}
	
	private ArrayList<GameMove> attack(int x, int y) {
		ArrayList<GameMove> moves = new ArrayList<GameMove>();
		if (currentColor == Cell.WHITE) {
			if (board[x][y] == Cell.WHITE) {
				if (x<7 && y>0 && board[x+1][y-1] == Cell.BLACK && validForMove(x+1,y-1)) {
					moves.add(new GameMove(x,y,x+1,y-1));
				}
				if (x<7 && y<7 && board[x+1][y+1] == Cell.BLACK && validForMove(x+1,y+1)) {
					moves.add(new GameMove(x,y,x+1,y+1));
				}
			}
		} else {
			if (board[x][y] == Cell.BLACK) {
				if (x>0 && y>0 && board[x-1][y-1] == Cell.WHITE && validForMove(x-1,y-1)) {
					moves.add(new GameMove(x,y,x-1,y-1));
				}
				if (x>0 && y<7 && board[x-1][y+1] == Cell.WHITE && validForMove(x-1,y+1)) {
					moves.add(new GameMove(x,y,x-1,y+1));
				}
			}
		}
		return moves;
	}

	private GameMove getNextMove(){
		ArrayList<GameMove> moves = genMoves();
		GameMove move = moves.get(random.nextInt(moves.size()));
		makeMove(move);
		return move;
	}
	
	private GameMove guardBack() {
		GameMove gb = null;
		if (currentColor == Cell.WHITE) {
			for (int i=0;i<BOARD_SIZE;i++) {
				if (board[1][i] == Cell.BLACK) {
					if (i>0 && board[0][i-1] == Cell.WHITE) {
						gb = new GameMove(0,i-1,1,i);
						if (board[gb.sx][gb.sy] == Cell.WHITE && validForMove(gb.ex, gb.ey)) {
							return gb;
						}
					}
					if (i<BOARD_SIZE-1 && board[0][i+1] == Cell.WHITE) {
						gb = new GameMove(0,i+1,1,i);
						if (board[gb.sx][gb.sy] == Cell.WHITE && validForMove(gb.ex, gb.ey)) {
							return gb;
						}
					}
				}
			}
		} else {
			for (int i=0;i<BOARD_SIZE;i++) {
				if (board[6][i] == Cell.WHITE) {
					if (i>0 && board[7][i-1] == Cell.BLACK) {
						gb = new GameMove(7,i-1,6,i);
						if (board[gb.sx][gb.sy] == Cell.BLACK && validForMove(gb.ex, gb.ey)) {
							return gb;
						}
					}
					if (i<BOARD_SIZE-1 && board[7][i+1] == Cell.BLACK) {
						gb = new GameMove(7,i+1,6,i);
						if (board[gb.sx][gb.sy] == Cell.BLACK && validForMove(gb.ex, gb.ey)) {
							return gb;
						}
					}
				}
			}
		}
		return null;
	}
	
	
	
	private GameMove guardArea() {
		ArrayList<GameMove> possible;
		GameMove ga = null;
		if (currentColor == Cell.WHITE) {
			for (int j=0;j<BOARD_SIZE;j++) {
				for (int i=1;i<=2;i++) {
					possible = attack(i,j);
					if (possible.size() > 0) {
						ga = possible.get(random.nextInt(possible.size()));
						return ga;
					}
				}
			}
		} else {
			for (int j=0;j<BOARD_SIZE;j++) {
				for (int i=6;i>=5;i--) {
					possible = attack(i,j);
					if (possible.size() > 0) {
						ga = possible.get(random.nextInt(possible.size()));
						return ga;
					}
				}
			}
		}
		return null;
	}
	
	private GameMove winFront() {
		GameMove wf = null;
		if (currentColor == Cell.WHITE) {
			for (int j=0;j<BOARD_SIZE;j++) {
				if (board[6][j] == Cell.WHITE) {
					if (validForMove(7, j-1)) {
						wf = new GameMove(6, j, 7, j-1);
						return wf;
					}
					if (validForMove(7, j+1)) {
						wf = new GameMove(6, j, 7, j+1);
						return wf;
					}
					if (validForMove(7,j) && board[7][j] == Cell.EMPTY) {
						wf = new GameMove(6, j, 7, j);
						return wf;
					}
				}
			}
		} else {
			for (int j=0;j<BOARD_SIZE;j++) {
				if (board[1][j] == Cell.BLACK) {
					if (validForMove(0, j-1)) {
						wf = new GameMove(1, j, 0, j-1);
						return wf;
					}
					if (validForMove(0, j+1)) {
						wf = new GameMove(1, j, 0, j+1);
						return wf;
					}
					if (validForMove(0,j) && board[0][j] == Cell.EMPTY) {
						wf = new GameMove(1, j, 0, j);
						return wf;
					}
				}
			}
		}
		return null;
	}
	
	private boolean notAttacked(int x, int y) {
		if (currentColor == Cell.WHITE) {
			if (x<BOARD_SIZE-1 && y>0 && board[x+1][y-1] == Cell.EMPTY) {
				if (x<BOARD_SIZE-1 && y<BOARD_SIZE-1 && board[x+1][y+1] == Cell.EMPTY) {
					return true;
				}
			}
		} else {
			if (x>0 && y>0 && board[x-1][y-1] == Cell.EMPTY) {
				if (x>0 && y<BOARD_SIZE-1 && board[x-1][y+1] == Cell.EMPTY) {
					return true;
				}
			}
		}
		return false;
	}
	
	private GameMove winWin() {
		GameMove ww = null;
		if (currentColor == Cell.WHITE) {
			for (int j=0;j<BOARD_SIZE;j++) {
				if (board[5][j] == Cell.WHITE) {
					if (validForMove(6, j-1)  && notAttacked(6,j-1)) {
						ww = new GameMove(5,j,6,j-1);
						return ww;
					}
					if (validForMove(6, j+1)  && notAttacked(6,j+1)) {
						ww = new GameMove(5,j,6,j+1);
						return ww;
					}
					if (validForMove(6, j) && board[6][j] == Cell.EMPTY  && notAttacked(6,j)) {
						ww = new GameMove(5,j,6,j);
						return ww;
					}
				}
			}
		} else {
			for (int j=0;j<BOARD_SIZE;j++) {
				if (board[2][j] == Cell.BLACK) {
					if (validForMove(1, j-1) && notAttacked(1,j-1)) {
						ww = new GameMove(2,j,1,j-1);
						return ww;
					}
					if (validForMove(1, j+1) && notAttacked(1,j+1)) {
						ww = new GameMove(2,j,1,j+1);
						return ww;
					}
					if (validForMove(1, j) && board[1][j] == Cell.EMPTY && notAttacked(1,j)) {
						ww = new GameMove(2,j,1,j);
						return ww;
					}
				}
			}
		}
		return null;
	}
	
	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("DVD");
				out.flush();
			}
			else if (theirMove.equals("Quit")){
				return;
			}
			else{
				if (!theirMove.equals("Start")){
					makeMove(new GameMove(theirMove));
				}
				GameMove wf = winFront(); 
				GameMove gb = guardBack();
				GameMove ga = guardArea();
				GameMove ww = winWin();
				if (wf != null) {
					makeMove(wf);
					out.println(wf);
					out.flush();
				} else if (gb != null) {
					makeMove(gb);
					out.println(gb);
					out.flush();
				} else if (ww != null) {
					makeMove(ww);
					out.println(ww);
					out.flush();
				} else if (ga != null) {
					makeMove(ga);
					out.println(ga);
					out.flush();
				} else {
					out.println(getNextMove().toString());
					out.flush();
				}
			}
		}
	}
}
