#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
using namespace std;

const int w = 8, h = 16;
typedef vector<vector<char>> board;
typedef vector<vector<int>> iboard;

board brd;

struct Factors {
	Factors() {
		fill_n(opened, 100, 0);
		fill_n(halfOpened, 100, 0);
		fill_n(closed, 100, 0);
	}
	int opened[100];
	int halfOpened[100];
	int closed[100];
	int height;
};

bool in(int x, int y) {
	return 0 <= x && x < h && 0 <= y && y < w; 
}

int free(const board& color, int x, int y, int dx, int dy)
{
	int res = 0;
	x += dx;
	y += dy;
	while (in(x, y) && color[x][y] == '.') {
		++res;
		x += dx;
		y += dy;
	}
	return res;
}

void addFactors(const board& color, const iboard& comp, int dx, int dy, Factors& res)
{
	int size[w * h + 1] = {0};
	int freePlus[w * h + 1] = {0};
	int freeMinus[w * h + 1] = {0};
	int number = 0;
	for(int i = 0; i < h; ++i) {
		for(int j = 0; j < w; ++j) {
			if (color[i][j] == '.' || color[i][j] == '*') continue;
			int cur = comp[i][j];
			size[cur]++;
			freePlus[cur] = max(freePlus[cur], free(color, i, j, dx, dy));
			freeMinus[cur] = max(freeMinus[cur], free(color, i, j, -dx, -dy));
			number = max(number, cur + 1);
		}
	}
	for(int i = 0; i < number; ++i) {
		int csize = size[i];
		if (csize == 0) continue;
		if (csize + freePlus[i] >= 4 && csize + freeMinus[i] >= 4) {
			res.opened[csize]++;
		} else if (csize + freePlus[i] + freeMinus[i] >= 4) {
			res.halfOpened[csize]++;
		} else {
			res.closed[csize]++;
		}
	}
}

int height(const board& brd) {
	int res = 0;
	for(int i = 0; i < h; ++i) {
		for(int j = 0; j < w; ++j) {
			if (brd[i][j] != '.') res = max(res, i);
		}
	}
	return res;
}

double score(const Factors& f)
{
	double oCoef[9] = {0, 3, 25, 50, 50, 50, 50, 50, 50};
	double hoCoef[9] = {0, 1, 15, 25, 50, 50, 50, 50, 50};
	double cCoef[9] = {0, -5, 0, 3, 50, 50, 50, 50, 50};
	double res = 0;
	for(int i = 0; i < 9; ++i) {
		res += oCoef[i] * f.opened[i] + hoCoef[i] * f.halfOpened[i] + cCoef[i] * f.closed[i];
	}
	res -= f.height * 8;
	return res;
}

void FindConnectedAreasHor(const board& brd, iboard& res)
{
	int col = 0;
	for(int i = h - 1; i >= 0; i--)
		for(int j = 0; j < w; j++)
		{
			if(j-1 >= 0 && brd[i][j] == brd[i][j-1])
				res[i][j] = res[i][j-1];
			else
				res[i][j] = col++;
		}	
}

void FindConnectedAreasVer(const board& brd, iboard& res)
{
	int col = 0;
	for(int j = 0; j < w; j++)
		for(int i = 0; i < h; i++)
		{
			if(in(i-1, j) && brd[i][j] == brd[i-1][j])
				res[i][j] = res[i-1][j];
			else
				res[i][j] = col++;
		}	
}

void readBoard(board& brd)
{
	scanf("\n");
	string s;
	for(int i = h - 1; i >= 0; i--)
	{
		cin >> s;
		brd[i].assign(s.begin(), s.end());
	}
}

board createBoard()
{
	board brd;
	for(int i = 0; i < h; i++)
		brd.push_back(vector<char>(w, '.'));
	return brd;
}

iboard createIBoard()
{
	iboard brd;
	for(int i = 0; i < h; i++)
		brd.push_back(vector<int>(w));
	return brd;
}


const long long A = 17235617;
const long long B = 4311271;
const long long M = 87465851;

struct Generator
{
	Generator() { }
	void setX(int x) { x_ = x;}
	Generator(int x): x_(x) { }
	int next() {
		int res = x_ % 5 + 1;
		x_ = (x_ * A + B) % M;
		return res;
	}
private:
	int x_;
};

board put(const board& b, int pos, int color)
{
	int x = h - 1;
	while (in(x - 1, pos) && b[x - 1][pos] == '.') --x;
	board res = b;
	res[x][pos] = color + '0';
	return res;
}

double calc(const board& brd)
{
	iboard hBoard = createIBoard();
	FindConnectedAreasHor(brd, hBoard);
	iboard vBoard = createIBoard();
	FindConnectedAreasVer(brd, vBoard);
	Factors fact;
	addFactors(brd, hBoard, 0, 1, fact);
	addFactors(brd, vBoard, 1, 0, fact);
	fact.height = height(brd);
	return score(fact);
}

double hor(int lc, int rc, int pos) {
	board newBoard = put(put(brd, pos, lc), pos + 1, rc);
	return calc(newBoard);
}

double ver(int lc, int rc, int pos) {
	board newBoard = put(put(brd, pos, lc), pos, rc);
	return calc(newBoard);
}

void go(int lc, int rc) {
	double res = -1e+9;
	int type = 0;
	int pos = 0;

	//0
	for(int i = 0; i < w - 1; ++i) {
		double nres = hor(lc, rc, i);
		if (res < nres) {
			res = nres;
			type = 0;
			pos = i;
		}
	}
	//2
	for(int i = 0; i < w - 1; ++i) {
		double nres = hor(rc, lc, i);
		if (res < nres) {
			res = nres;
			type = 2;
			pos = i;
		}
	}
	//1
	for(int i = 0; i < w; ++i) {
		double nres = ver(rc, lc, i);
		if (res < nres) {
			res = nres;
			type = 1;
			pos = i;
		}
	}
	//3
	for(int i = 0; i < w; ++i) {
		double nres = ver(lc, rc, i);
		if (res < nres) {
			res = nres;
			type = 3;
			pos = i;
		}
	}
	printf("%d %d\n", pos, type);
	fflush(stdout);
}

int main()
{
//	freopen("input.txt", "r", stdin);
	int x0;
	Generator g;
	for(int i = 0 ; ; ++i)
	{
		char str[100];
		scanf("%s",str);
		if(!strcmp(str,"Quit"))
		  break;
		if(!strcmp(str,"Start")) {
			scanf("%d", &x0);
			g.setX(x0);
			printf("GovBot\n");
			fflush(stdout);
		}
		else if(!strcmp(str,"Move")) {
			brd = createBoard();
			board brdApponent = createBoard();
			readBoard(brd);	
			readBoard(brdApponent);
			int a = g.next();
			int b = g.next();
			go(a, b);
			fflush(stdout);
		}
	}

	return 0;
}
