/*------------------------------------------------------------
TEAM35
A
235
Target: MSVC9; Platform: Win32; Comment: MS Visual C++ 9
------------------------------------------------------------*/
#include <queue>
#include <math.h>
#include <map>
#include <set>
#include <stack>
#include <time.h>

using namespace std;

typedef vector<int> VI;

#define CL(x) memset(x, 0, sizeof(x))
#define CLR(x, y) memset(x, y, sizeof(x))

#define BOARD_SIZE 8
#define MAX_MOVES (BOARD_SIZE*2*3)

enum {EMPTY,WHITE,BLACK};

struct game_move {
	int sx,sy;
	int ex,ey;
	int is_capture;
};

inline int op_color(int color) {
	return color==WHITE ? BLACK : WHITE;
}

char board[BOARD_SIZE][BOARD_SIZE];
char save_board[BOARD_SIZE][BOARD_SIZE];

void init() {
	memset(board,EMPTY,sizeof(board));
	for(int i=0;i<BOARD_SIZE;++i) {
		board[0][i]=board[1][i]=WHITE;
		board[BOARD_SIZE-1][i]=board[BOARD_SIZE-2][i]=BLACK;
	}
}

const int dxatack[] = {1, -1, 0};

int At = -1;
int MyColor = BLACK;

bool Bound(int x, int y)
{
	return x >= 0 && x < BOARD_SIZE && y >= 0 && y < BOARD_SIZE;  
}

//bool IsOurAssHole(P & a)
//{
//	queue<int> Q;
//	int D[BOARD_SIZE][BOARD_SIZE];
//	for(int i = 0; i < BOARD_SIZE; ++i)
//	{
//		for(int j = 0; j < BOARD_SIZE; ++j)
//		{
//			if (board[i][j] == MyColor)
//			{
//				CLR(D, -1);
//				Q.push(0);
//				Q.push(i);
//				D[0][i] = 0;
//				while (!Q.empty())
//				{
//					int x = Q.front();
//					Q.pop();
//					int y = Q.front();
//					Q.pop();
//					for(int j = 0; j < 4; ++j)
//					{
//						int tox = x + dx[j];
//						int toy = y + dy[j];
//						if (Bound(tox, toy) && D[tox][toy] == -1)
//						{
//							D[tox][toy] = D[x][y] + 1;
//							Q.push(tox);
//							Q.push(toy);
//						}
//					}
//				}
//			}
//		}
//	}
//}
inline int get_color(int color) {
	return color==WHITE ? 1 : -1;
}

void Attack()
{
	int pi = At / 10;
	int pj = At % 10;
	board[pi][pj] = EMPTY;
	printf("%c%c", pj + 'a', pi + '1');
	pi = pi + get_color(MyColor);
	board[pi][pj] = MyColor;
	printf("%c%c\n", pj + 'a', pi + '1');
}


inline int r(int color, int i)
{
	return (color == WHITE) ? i : 7 - i;
}

void Defend()
{
	VI Pair;

	CL(save_board);
	for (int i = 0; i < BOARD_SIZE; i++)
	{
		for (int j = 0; j < BOARD_SIZE; j++)
		{
			if (At != i * 10 + j)
			{
				if (board[i][j] == MyColor)
				{
					for (int k = 0; k < 2; k++)
					{
						int new_i = i + get_color(MyColor);
						int new_j = j + dxatack[k];
						if (Bound(new_i, new_j) && board[new_i][new_j] == op_color(MyColor))
						{
							Pair.push_back((i * 10 + j) * 100 + new_i * 10 + new_j);
						}
					}
				}
				else
				{
					if (board[i][j] == op_color(MyColor))
					{
						for (int k = 0; k < 2; k++)
						{
							int new_i = i + get_color(op_color(MyColor));
							int new_j = j + dxatack[k];
							if (Bound(new_i, new_j))
							{
								save_board[new_i][new_j] = 1;
							}
						}
					}
				}
			}
		}
	}

	if (!Pair.empty())
	{
		int best = 0;
		for (size_t i = 1; i < Pair.size(); i++)
		{
			int npi = Pair[i] % 100 / 10;
			int nbi = Pair[best] % 100 / 10;
			if (r(MyColor, npi) < r(MyColor, nbi))
			{
				best = i;
			}
		}
		int pi = Pair[best] / 1000;
		int pj = Pair[best] % 1000 / 100;
		int npi = Pair[best] % 100 / 10;
		int npj = Pair[best] % 10;
		board[pi][pj] = EMPTY;
		board[npi][npj] = MyColor;
		printf("%c%c%c%c\n", pj + 'a', pi + '1', npj + 'a', npi + '1');
		return;
	}

	VI SavePair;
	for (int i = 0; i < BOARD_SIZE; i++)
	{
		for (int j = 0; j < BOARD_SIZE; j++)
		{
			if (At != i * 10 + j)
			{
				if (board[i][j] == MyColor)
				{
					for (int k = 2; k >= 0; k--)
					{
						int new_i = i + get_color(MyColor);
						int new_j = j + dxatack[k];
						if (Bound(new_i, new_j) && board[new_i][new_j] == EMPTY)
						{
							Pair.push_back((i * 10 + j) * 100 + new_i * 10 + new_j);
							if (save_board[new_i][new_j] == 0)
							{
								SavePair.push_back((i * 10 + j) * 100 + new_i * 10 + new_j);
							}
						}
					}
				}
			}
		}
	}

	if (!SavePair.empty())
	{
		int best = 0;
		for (int i = 1; i < SavePair.size(); i++)
		{
			int npi = SavePair[i] % 100 / 10;
			int nbi = SavePair[best] % 100 / 10;
			if (r(MyColor, npi) < r(MyColor, nbi))
			{
				best = i;
			}
		}
		int pi = SavePair[best] / 1000;
		int pj = SavePair[best] % 1000 / 100;
		int npi = SavePair[best] % 100 / 10;
		int npj = SavePair[best] % 10;
		board[pi][pj] = EMPTY;
		board[npi][npj] = MyColor;
		printf("%c%c%c%c\n", pj + 'a', pi + '1', npj + 'a', npi + '1');
		return;
	}

	int best = rand() % Pair.size();
	int pi = Pair[best] / 1000;
	int pj = Pair[best] % 1000 / 100;
	int npi = Pair[best] % 100 / 10;
	int npj = Pair[best] % 10;
	board[pi][pj] = EMPTY;
	board[npi][npj] = MyColor;
	printf("%c%c%c%c\n", pj + 'a', pi + '1', npj + 'a', npi + '1');
}

bool CanAttack()
{
	CL(save_board);

	for (int i = 0; i < BOARD_SIZE; i++)
	{
		for (int j = 0; j < BOARD_SIZE; j++)
		{
			if (board[i][j] == op_color(MyColor))
			{
				for (int k = 0; k < 2; k++)
				{
					int new_i = i + get_color(op_color(MyColor));
					int new_j = j + dxatack[k];
					if (Bound(new_i, new_j))
					{
						save_board[new_i][new_j] = 1;
					}
				}
			}
		}
	}

	for (int i = 0; i < BOARD_SIZE; i++)
	{
		for (int j = 0; j < BOARD_SIZE; j++)
		{
			if (board[i][j] == MyColor)
			{
				if (MyColor == WHITE)
				{
					if (i == 6)
					{
						At = i * 10 + j;
						return 1;
					}
				}
				else
				{
					if (i == 2)
					{
						At = i * 10 + j;
						return 1;
					}
				}
				int bound = (MyColor == WHITE) ? 7 : 0;
				int min_j = j + 1;
				int max_j = j - 1;
				int b = 0;
				for (int ii = i + get_color(MyColor); i < bound; i = i + get_color(MyColor))
				{
					min_j--;
					max_j++;
					if (min_j < 0)
					{
						min_j = 0;
					}
					if (7 < max_j)
					{
						max_j = 7;
					}
					for (int k = min_j; k <= max_j; k++)
					{
						if (save_board[ii][k] == 1 && board[ii][k] == EMPTY)
						{
							b = 1;
							break;
						}
					}
					if (b)
					{
						break;
					}
				}
				if (!b)
				{
					At = i * 10 + j;
					return 1;
				}
			}
		}
	}

	return 0;
}

int main() {
	srand(time(0));
	init();
	for(;;) {
		char str[100];
		gets(str);
		if(!strcmp(str,"Name")) {
			// Request for the bot name
			printf("Code::Bots\n");
			fflush(stdout);
		}
		else if(!strcmp(str,"Quit")) {
			// Game is over
			break;
		}
		else {
			if(!strcmp(str,"Start")) {
				//isWhite = 1;
				MyColor = WHITE;
			}
			else
			{
				char begin[2], end[2];
				sscanf(str, "%c%c%c%c", begin + 1, begin, end + 1, end);
				begin[0] -= '1';
				begin[1] -= 'a';
				end[0] -= '1';
				end[1] -= 'a';
				if (At != -1 && end[0] * 10 + end[1] == At)
				{
					At = -1;
				}
				board[end[0]][end[1]] = board[begin[0]][begin[1]];
				board[begin[0]][begin[1]] = EMPTY;
			}
			if (CanAttack())
				Attack();
			else
				Defend();
			fflush(stdout);
		}
	}
	return 0;
}
