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

#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <algorithm>
#include <cassert>
#include <ctime>
#include <complex>
#include <cmath>
#include <functional>
#include <iomanip>
#include <cstdlib>
#include <list>
#include <queue>
#include <stack>

using namespace std;

#define forn(i,n) for (int i = 0; i < (int)n; i ++)
#define ford(i,n) for (int i = n-1; i >= 0; i --)
#define pb push_back
#define all(a) a.begin(), a.end()
#define mp make_pair
#define last(a) (int)a.size()-1
#define fs first
#define sc second
#define seta(x,y) memset (x, y, sizeof (x))
#define I (int)

typedef long long int64;
typedef pair <int, int> pii;
typedef long double ldb;

const int inf = (1 << 30) - 1;
const int64 inf64 = (1LL << 62) - 1;
const ldb eps = 1e-9;
const int N = 8;
int ccount = 0;

template <class T> T sqr (const T&a) {return a * a;}


char** a;
int col, K = 0;
char OurCol;

void rotate (char** a, int type);
void init ();
void make_move (string s);

#define make_arr(a) \
	a=new char*[N];\
	for (int iii=0; iii<N; iii++)\
		a[iii]=new char[N]

#define del_arr(a) \
	for (int iii=0; iii<N; iii++)\
		delete [](a[iii]);\
	delete []a


void init ()
{
	make_arr(a);
	forn (i, N)
		forn (j, N)
			a[i][j] = 0;
	forn (i, N)
	{
		a[0][i] = a[1][i] = 'W';
		a[N-1][i] = a[N-2][i] = 'B';
	}
	col = 0;
}

void make_move (string s)
{
	if (col == 1)
	{
		rotate(a, 1);
		make_move (s);
		rotate(a, 1);
		return;
	}
	char c1, c2, c3, c4;
	sscanf (s.data(), "%c%c%c%c", &c1, &c2, &c3, &c4);
	a[c4-'1'][c3-'a'] = a[c2-'1'][c1-'a'];
	a[c2-'1'][c1-'a'] = 0;
	rotate(a, 1);
}

string move (int x1, int y1, int x2, int y2)
{
	char ch[10];
	if (col == 0) {
		sprintf (ch, "%c%c%c%c", y1+'a', x1+'1', y2+'a', x2+'1');
	}
	else
		sprintf (ch, "%c%c%c%c", N-y1-1+'a', N-x1-1+'1', N-y2-1+'a', N-x2-1+'1');
	return (string)ch;
}

int calc1 (char** a)
{
	int res = 0;
	bool u[N][N];
	seta (u, 0);
	forn (i, N)
		forn (j, N)
			if (a[i][j] == 'W')
			{
				if (i == N-1)
					res += 100000000;
				res += 200000;
				for (int k = -1; k <= 1; k += 2)
					if (0 <= j+k && j+k < N)
						u[i+1][j+k] = 1;
			}

	forn (i, N)
		forn (j, N)
			if (u[i][j])
			{
				if (a[i][j] == 'W')
					res += 500*(i+5)*(i+5);
				else
					res += 50*(i+5)*(i+5);
				if (i < 3 && a[i][j] == 0)
					res += 200*(i+5)*(i+5);
				if (j + 1 < N && u[i][j+1])
					res += 200*(i+5)*(i+5);
			}
			else
			if (!u[i][j])
				res -= 10 * (min (j, 7-j) * min (j, 7-j));
	int s[10][20];
	seta (s, 0);
	ford (i, N)
		for (int j = 0; j < 20; j ++)
		{
			s[i][j] = -s[i+2][j];
			if (j > 0)
				s[i][j] += s[i+1][j-1];
			if (j + 1 < 20)
				s[i][j] += s[i+1][j+1];
			if (0 <= j-5 && j-5 < 8)
			{
				if (a[i][j-5] == 'B')
					s[i][j] ++;
				if (i + 1 < N)
				if (a[i+1][j-5] == 'B')
					s[i][j] ++;
			}
		}
	forn (i, N)
		forn (j, N)
			if (a[i][j] == 'W' && s[i][j] <= 1)
				res += j * j * 1000;
	return res;	
}

int calc (char** a)
{
	int res = calc1 (a);
	rotate (a, 1);
	res -= calc1 (a);
	rotate (a, 0);
	return res;
}

vector <int> go (char** a, int depth)
{
	vector <int> res;
	res.resize (5);
	res[0] = -inf;
	if (depth == 0)
	{
		res[0] = calc (a);
		return res;
	}
	forn (i, N)
		forn (j, N)
			if (a[i][j] == 'W')
				for (int k = 1; k >= -1; k --)
					if (0 <= j+k && j+k < N)
						if (a[i+1][j+k] == 0 || (a[i+1][j+k] == 'B' && abs(k) == 1))
						{
							if (i + 1 == N-1)
							{
								res[0] = inf;
								res[1] = i;
								res[2] = j;
								res[3] = i+1;
								res[4] = j+k;
								return res;
							}
							char **b;
							make_arr(b);
							forn(ii,N)
								forn(jj,N)
									b[ii][jj]=a[ii][jj];
							b[i+1][j+k] = b[i][j];
							b[i][j] = 0;
							rotate(b, 1);
							vector <int> tmp = go (b, depth-1);
							rotate(b, 0);
							del_arr(b);
							tmp[0] *= -1;
							if (tmp > res)
							{
								res = tmp;
								res[1] = i;
								res[2] = j;
								res[3] = i+1;
								res[4] = j+k;
							}
						}
	return res;
}

void rotate (char **a, int type)
{
	if (type == 0)
	{
		col ^= 1;
		return;
	}
	K ++;
	forn (i, N)
		forn (j, N/2)
			swap (a[i][j], a[N-i-1][N-j-1]);
	forn (i, N)
		forn (j, N)
			if (a[i][j] == 'W')
				a[i][j] = 'B';
			else
			if (a[i][j] == 'B')
				a[i][j] = 'W';
	col ^= 1;
}

/*vector < int> my_move(char **a)
{
	vector <int> res;
	res.resize(5);
	char ch[10];
	if (ccount == 0) 
		res ('b', '2', 'c', '3');
		sprintf (ch, "%c%c%c%c", 'b', '2', 'c', '3');
	if (ccount == 1) 
		sprintf (ch, "%c%c%c%c", 'a', '1', 'b', '2');
	if (ccount == 2) 
		sprintf (ch, "%c%c%c%c", 'a', '2', 'b', '3');
	if (ccount == 3) 
		sprintf (ch, "%c%c%c%c", 'g', '7', 'f', '6');
	if (ccount == 4) 
		sprintf (ch, "%c%c%c%c", 'h', '8', 'g', '7');
	if (ccount == 5) 
		sprintf (ch, "%c%c%c%c", 'h', '7', 'g', '6');
	return (string)ch;}
*/

bool may(char **a)
{
	forn(i, N)
		forn(j, N)
			for (int k = -1; k <= 1; k++)
				if (a[i][j] == 'W' && k + j >= 0 && k + j < N && a[i][j + k] == 'B') return false;
	return true;
}

int main ()
{
	init();
	ccount = 0;
	while (1) 
	{
	    string S;
		cin >> S;
		if(S == "Name") 
		{
			printf("MSU ST BOT9\n");
			fflush(stdout);
		}
		else 
		if(S == "Quit") 
			break;
	    else 
		{
			if(S != "Start") 
		        make_move(S);
			vector <int> tmp;
				tmp = go(a, 3);
			ccount++;

			S = move (tmp[1], tmp[2], tmp[3], tmp[4]);
			make_move (S);
			printf("%s\n",S.data());
			fflush(stdout);
		}
	}
	freopen ("output.txt", "w", stdout);
	cout << K << endl;
	return 0;
}
