#include <cstdio>
#include <cstring>
#include <stdlib.h>
#include <time.h>

int x0;

int table1[16][8];
int table2[16][8];

int weight1[16][8];
int weight2[16][8];

int turns[8][4];

int x(int i)
{
	if (i == 0)
		return x0;
	else
	{
		return (x(i-1) * 17235617 + 4311271) % 87465851;
	}
}

int K_sbor = 5;
int K_height = 1;
int K_delblack = 1;
/*
int ocenka(int ax,int color)
{
	int top;
	for(int top = 15; top >= 0; --top)
	{
		if (table1[top][ax] == 0) break;
	}
	top--;
	int answ = 0;
	if (top < 15)
	{
		if (table1[top-1][ax] == color)
		{
			if (weight1[top-1][ax] == 3)
			{
				answ -= weight1[top-1][ax] * 4 * K_sbor;
			} else {
				answ += weight1[top-1][ax] * 4 * K_sbor;
			}
		} else {
			answ -= 2 * K_sbor;
		}
	}
	if (ax > 0 && table1[top][ax-1] == color)
	{
		if (weight1[top][ax-1] == 3)
		{
			answ -= weight1[top][ax-1] * 4 * K_sbor;
		} else {
			answ += weight1[top][ax-1] * 4 * K_sbor;
		}
	}
	if (ax < 7 && table1[top-1][ax] == color)
	{
		if (weight1[top][ax+1] == 3)
		{
			answ -= weight1[top][ax+1] * 4 * K_sbor;
		} else {
			answ += weight1[top][ax+1] * 4 * K_sbor;
		}	
	}

	answ -= (16 - top) * K_height;

	return answ;
}
*/
int main()
{
	srand(time(0));
	int w = 8, h = 16;
	for(int i = 0 ; ; ++i)
	{
		char str[100];
		scanf("%s",str);
		if(!strcmp(str,"Quit"))
		  break;
		if(!strcmp(str,"Start")) {
			scanf("%d", &x0);
			printf("Good Luck. Have Fun.\n");
			fflush(stdout);
		}
		else if(!strcmp(str,"Move")) {
			/*for(int j = 0; j < 2 * h; j++)
				scanf("%*s");
			printf("%d %d\n", i % w, 1);*/
			/*int a = x(2*i-2) % 5 + 1;
			int b = x(2*i-1) % 5 + 1;
			for (int j = 0 ; j < h; ++j)
			{
				char ch;
				for (int k = 0; k < w-1; ++k)
				{
					scanf("%c",&ch);
					if (ch == '.')
						table1[j][k] = 0;
					else if (ch == '*')
						table1[j][k] = -1;
					else 
						table1[j][k] = ch - '0';
				}
				scanf("%c\n",&ch);
				if (ch == '.')
					table1[j][w-1] = 0;
				else if (ch == '*')
					table1[j][w-1] = -1;
				else 
					table1[j][w-1] = ch - '0';
			}
			char t;
			scanf("%c",&t);
			for (int j = 0 ; j < h; ++j)
			{
				char ch;
				for (int k = 0 ; k < w-1; ++k)
				{
					scanf("%c",&table2[j][k]);
					if (ch == '.')
						table2[j][k] = 0;
					else if (ch == '*')
						table2[j][k] = -1;
					else 
						table2[j][k] = ch - '0';
				}
				scanf("%c\n",&table2[j][w-1]);
				if (ch == '.')
					table2[j][w-1] = 0;
				else if (ch == '*')
					table2[j][w-1] = -1;
				else 
					table2[j][w-1] = ch - '0';
			}
			if (i == 0)
			{
				if (a == b)
				{
					weight1[15][3] = 2;
					weight1[15][4] = 2;
				}
				else
				{
					weight1[15][3] = 1;
					weight1[15][4] = 1;	
				}
				printf("%d %d\n",3,0);
			}
			else
			{
				/*for (int j = 0; j < 8; ++j)
				{
					int save = ocenka(j,a);
					for (int k = 0; k < 4; ++k)
					{
						int j2 = j;
						if (k == 0) j2 += 1;
						if (k == 2) j2 -= 1;
						if (j2 >= 0 && j2 <8)
							turns[j][k] = save + ocenka(j2,b);
					}
					
				}
				int maxj,maxk,max;
				max = -32000;
				for (int j = 0; j < 8; ++j)
				{
					for (int k = 0; k < 4; ++k)
					{
						if (turns[j][k] > max)
						{
							max = turns[j][k];
							maxj = j;
							maxk = k;
						}
					}
				}*/
				/*int maxj = 4;
				int maxk = 2;
				printf("%d %d\n",maxj,maxk);
			}*/
			int s = rand() % 6 + 1;
			int r = rand() % 4;
			printf("%d %d\n", s, r);
			fflush(stdout);
		}
	}

	return 0;
}