/*------------------------------------------------------------
TEAM37
A
231
Target: MSVC9; Platform: Win32; Comment: MS Visual C++ 9
------------------------------------------------------------*/
#define _CRT_SECURE_NO_DEPRECATE

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>

using namespace std;

#define mp make_pair
#define pb push_back
#define fi(a,b) for (i=a;i<=b;i++)
#define fj(a,b) for (j=a;j<=b;j++)
#define fo(a,b) for (o=a;o<=b;o++)
#define fdi(a,b) for (i=a;i>=b;i--)
#define fdj(a,b) for (j=a;j>=b;j--)
#define fdo(a,b) for (o=a;o>=b;o--)
#define SIZE(x) (int)x.size()

#define BOARD_SIZE 8
#define MAX_MOVES (BOARD_SIZE*2*3)
#define MAX_DEEP 5
#define INF 1000000

int n = BOARD_SIZE;

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 + 1][BOARD_SIZE + 1];
int color;

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

void make_move(game_move &move) {
	board[move.ey][move.ex]=board[move.sy][move.sx];
	board[move.sy][move.sx]=EMPTY;
	color=op_color(color);
}

void make_move(char *str) {
	int sy,ey;
	char sx,ex;
	sscanf(str,"%c%d%c%d",&sx,&sy,&ex,&ey);
	game_move move={sx-'a'+1, sy, ex-'a'+1, ey, board[ey][ex-'a'+1] != EMPTY};
	make_move(move);
}

game_move moves[MAX_MOVES];
int cnt;

bool Empty(int x, int y) {
	if (x < 1 || x > n) return false;
	if (y < 1 || y > n) return false;
	if (board[y][x] == EMPTY) return true;
	return false;
}

bool White(int x, int y) {
	if (x < 1 || x > n) return false;
	if (y < 1 || y > n) return false;
	if (board[y][x] == WHITE) return true;
	return false;
}

bool Black(int x, int y) {
	if (x < 1 || x > n) return false;
	if (y < 1 || y > n) return false;
	if (board[y][x] == BLACK) return true;
	return false;
}

int FunWhite(int curmin);
int FunBlack(int curmax);

int d;

int Whites(int x1, int y1, int x2, int y2) {
	int i, j;
	int res;
	res = 0;
	fj(min(y1, y2), max(y1, y2)) {
		fi(min(x1, x2), max(x1, x2)) {
			if (White(i, j)) res++;
		}
	}
	return res;
}

int Blacks(int x1, int y1, int x2, int y2) {
	int i, j;
	int res;
	res = 0;
	fj(min(y1, y2), max(y1, y2)) {
		fi(min(x1, x2), max(x1, x2)) {
			if (Black(i, j)) res++;
		}
	}
	return res;
}

int Score() {
	int sb, sw;
	int qb, qw;
	int i, j;
	sb = 0;
	sw = 0;
	qw = 0;
	qb = 0;
	fj(1, n) {
		fi(1, n) {
			if (board[j][i] == WHITE) {
				if (j == n) return (INF - d);
				//if (j == 5 && Whites(i - 1, j, i + 1, j - 2) >= 3) sw += 2;
				if (j == 6 && Whites(i - 3, j, i + 3, j - 2) >= 2) sw += 4;

				if (j == 7 && Whites(i - 2, j, i + 2, j - 2) >= 2) sw += 7;

				if (j >= 5 && (i <= 1 || i >= 8)) sw += 2;

				sw += n - j + 1;
				//if (j == 1) sw += 1;
				qw += 9;
			}
			if (board[j][i] == BLACK) {
				if (j == 1) return -(INF - d);
				//if (j == 4 && Blacks(i - 1, j, i + 1, j + 2) >= 3) sb += 2;
				if (j == 3 && Blacks(i - 3, j, i + 3, j + 2) >= 2) sb += 4;

				if (j == 2 && Blacks(i - 2, j, i + 2, j + 2) >= 2) sb += 7;

				if (j <= 4 && (i <= 1 || i >= 8)) sb += 2;

				sb += j;
				//if (j == n) sb += 1;
				qb += 9;
			}
		}
	}
	return (qw - qb) + (sw - sb);
}

bool CheckWin() {
	int i, j;
	int fw, fb;
	fw = 0;
	fb = 0;
	fj(1, n) {
		fi(1, n) {
			if (board[j][i] == WHITE) {
				fw = 1;
				if (j == n) return true;
			}
			if (board[j][i] == BLACK) {
				fb = 1;
				if (j == 1) return true;
			}
		}
	}
	if (!fw || !fb) return true;
	return false;
}

game_move funmove;

int FunWhite(int curmin = INF * 2) {
	int i, j;
	int res;
	int g;

	if (CheckWin()) return Score();
	
	if (d >= MAX_DEEP) return Score();

	res = -INF * 2;

	d++;
	fdj(n, 1) {
		fi(1, n) {
			if (!White(i, j)) continue;
			if (Empty(i - 1, j + 1)) {
				swap(board[j + 1][i - 1], board[j][i]);
				g = FunBlack(res);
				if (g > res) {
					res = g;
					if (d == 1) {
						funmove.sx = i;
						funmove.sy = j;
						funmove.ex = i - 1;
						funmove.ey = j + 1;
						funmove.is_capture = false;
					}
				}
				swap(board[j + 1][i - 1], board[j][i]);
			}
			if (Empty(i, j + 1)) {
				swap(board[j + 1][i], board[j][i]);
				g = FunBlack(res);
				if (g > res) {
					res = g;
					if (d == 1) {
						funmove.sx = i;
						funmove.sy = j;
						funmove.ex = i;
						funmove.ey = j + 1;
						funmove.is_capture = false;
					}
				}
				swap(board[j + 1][i], board[j][i]);
			}
			if (Empty(i + 1, j + 1)) {
				swap(board[j + 1][i + 1], board[j][i]);
				g = FunBlack(res);
				if (g > res) {
					res = g;
					if (d == 1) {
						funmove.sx = i;
						funmove.sy = j;
						funmove.ex = i + 1;
						funmove.ey = j + 1;
						funmove.is_capture = false;
					}
				}
				swap(board[j + 1][i + 1], board[j][i]);
			}
			if (Black(i - 1, j + 1)) {
				board[j + 1][i - 1] = WHITE;
				board[j][i] = EMPTY;
				g = FunBlack(res);
				if (g > res) {
					res = g;
					if (d == 1) {
						funmove.sx = i;
						funmove.sy = j;
						funmove.ex = i - 1;
						funmove.ey = j + 1;
						funmove.is_capture = true;
					}
				}
				board[j + 1][i - 1] = BLACK;
				board[j][i] = WHITE;
			}
			if (Black(i + 1, j + 1)) {
				board[j + 1][i + 1] = WHITE;
				board[j][i] = EMPTY;
				g = FunBlack(res);
				if (g > res) {
					res = g;
					if (d == 1) {
						funmove.sx = i;
						funmove.sy = j;
						funmove.ex = i + 1;
						funmove.ey = j + 1;
						funmove.is_capture = true;
					}
				}
				board[j + 1][i + 1] = BLACK;
				board[j][i] = WHITE;
			}
			if (d != 1 && res >= curmin) {
				d--;
				return res;
			}
		}
	}
	d--;
	return res;
}

int FunBlack(int curmax = -INF * 2) {
	int i, j;
	int g;
	int res;

	if (CheckWin()) return Score();

	if (d >= MAX_DEEP) return Score();

	res = INF * 2;

	d++;
	fj(1, n) {
		fi(1, n) {
			if (d == 2 && i == 6 && j == 5) {
				i = i;
			}
			if (!Black(i, j)) continue;
			if (Empty(i - 1, j - 1)) {
				swap(board[j - 1][i - 1], board[j][i]);
				g = FunWhite(res);
				if (g < res) {
					res = g;
					if (d == 1) {
						funmove.sx = i;
						funmove.sy = j;
						funmove.ex = i - 1;
						funmove.ey = j - 1;
						funmove.is_capture = false;
					}
				}
				swap(board[j - 1][i - 1], board[j][i]);
			}
			if (Empty(i, j - 1)) {
				swap(board[j - 1][i], board[j][i]);
				g = FunWhite(res);
				if (g < res) {
					res = g;
					if (d == 1) {
						funmove.sx = i;
						funmove.sy = j;
						funmove.ex = i;
						funmove.ey = j - 1;
						funmove.is_capture = false;
					}
				}
				swap(board[j - 1][i], board[j][i]);
			}
			if (Empty(i + 1, j - 1)) {
				swap(board[j - 1][i + 1], board[j][i]);
				g = FunWhite(res);
				if (g < res) {
					res = g;
					if (d == 1) {
						funmove.sx = i;
						funmove.sy = j;
						funmove.ex = i + 1;
						funmove.ey = j - 1;
						funmove.is_capture = false;
					}
				}
				swap(board[j - 1][i + 1], board[j][i]);
			}
			if (White(i - 1, j - 1)) {
				board[j - 1][i - 1] = BLACK;
				board[j][i] = EMPTY;
				g = FunWhite(res);
				if (g < res) {
					res = g;
					if (d == 1) {
						funmove.sx = i;
						funmove.sy = j;
						funmove.ex = i - 1;
						funmove.ey = j - 1;
						funmove.is_capture = true;
					}
				}
				board[j - 1][i - 1] = WHITE;
				board[j][i] = BLACK;
			}
			if (White(i + 1, j - 1)) {
				board[j - 1][i + 1] = BLACK;
				board[j][i] = EMPTY;
				g = FunWhite(res);
				if (g < res) {
					res = g;
					if (d == 1) {
						funmove.sx = i;
						funmove.sy = j;
						funmove.ex = i + 1;
						funmove.ey = j - 1;
						funmove.is_capture = true;
					}
				}
				board[j - 1][i + 1] = WHITE;
				board[j][i] = BLACK;
			}
			if (d != 1 && res <= curmax) {
				d--;
				return res;
			}
		}
	}
	d--;
	return res;
}

game_move RandomMove() {
	game_move moves[MAX_MOVES];
	int i, j;
	int cnt=0;
	for(i=1; i<=n; i++) {
		for(j=1; j<=n; j++) {
			if(board[j][i]==color) {
				for(int di= -1; di<=1; di++) {
					int ni = i + di;
					int nj = j + (color==WHITE ? 1 : -1);
					if(ni >= 1 && ni <= BOARD_SIZE && nj >= 1 && nj <= BOARD_SIZE &&
						board[nj][ni] != color && (di || board[nj][ni] == EMPTY)) {
							game_move move={i,j,ni,nj,board[nj][ni] != EMPTY};
							moves[cnt++]=move;
					}
				}
			}
		}
	}
	return moves[rand() % cnt];
}

int move_num;

game_move Do() {
	move_num++;
	funmove.sx = -1;

	if (move_num == 49) {
		move_num = move_num;
	}

	if (color == WHITE) {
		FunWhite();
	} else {
		FunBlack();
	}

	if (funmove.sx == -1) {
		//funmove = RandomMove();
	}

	return funmove;
}


void think(char *str) {

//	cnt = gen_moves(moves);

	game_move move;

	move = Do();

	/*f = 0;

	fi(0, cnt - 1) {
		if (moves[i].is_capture) {
			move = moves[i];
			f = 1;
			break;
		}
	}

	if (!f) move = moves[0];*/

	sprintf(str,"%c%d%c%d", move.sx + 'a' - 1, move.sy, move.ex + 'a' - 1, move.ey);

	make_move(move);
}

int main() {
	srand((int)time(0));
	init();
	for(;;) {
		char str[100];
		gets(str);
		if(!strcmp(str,"Name")) {
			// Request for the bot name
			printf("Yoshka\n");
			fflush(stdout);
		}
		else if(!strcmp(str,"Quit")) {
			// Game is over
			break;
		}
		else {
			if(strcmp(str,"Start")) {
				// Enemy's move
				make_move(str);
			}
			// Our move
			think(str);
			printf("%s\n",str);
			fflush(stdout);
		}
	}
	return 0;
}
