import java.io.*;
import java.util.*;

public class SampleBot
{
	public void run() {
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		

		h = 16;
		w = 8;
		x0 = 0;
		ourField = new char[h][w];
		for(int i = 0 ; ; ++i)
		{
			String str = in.next();
			if (str.equals("Quit"))
				break;
			else if (str.equals("Start"))
			{
				x0 = in.nextInt();
				out.println("Slowpoke");
				out.flush();
			}
			else if (str.equals("Move"))
			{
				for(int j = 0; j < h; j++)
					ourField[h-j-1] = in.next().toCharArray();
				
				for (int j = 0; j < h; ++j) {
					in.next();
				}
				
				makeStep(ourField);
				out.println(bestS + " " + bestR);
				//out.println("0 0");
				//out.print(i % w);
				//out.println(" 1");
				out.flush();
			}
		}

		out.close();
	}
	
	void nextIter() {
		x0 = (x0*17235617 + 4311271)%87465851;
	}
	
	int[] nextBall() {
		int[] res = new int[2];
		res[0] = (int)(x0 % 5 + 1);
		nextIter();
		res[1] = (int)(x0 % 5 + 1);
		nextIter();
		return res;
	}
	
	char[][] fall(char[][] field, int s, int r, int[] b) {
		int[] ball = b.clone();
		
		if (r == 3 || r == 2) {
			int tmp = ball[0];
			ball[0] = ball[1];
			ball[1] = tmp;
		}
		char[][] f = new char[h][w];
		for (int i = 0; i < h; ++i) {
			f[i] = field[i].clone();
		}
		if (r == 0 || r == 2) {
			int min1 = 0;
			for (int i = h-1; i >= 0; --i) {
				if (f[i][s] != '.') {
					min1 = i+1;
					break;
				}
			}
			if (min1 >= h-1)
				dontDoThisStep = true;
			else {
				f[min1][s] = (char)('0' + ball[0]);
			}
			
			int min2 = 0;
			for (int i = h-1; i >= 0; --i) {
				if (f[i][s+1] != '.') {
					min2 = i+1;
					break;
				}
			}
			if (min2 >= h-1)
				dontDoThisStep = true;
			else {
				f[min2][s+1] = (char)('0' + ball[1]);
			}
		}
		else {
			int min = 0;
			for (int i = h-1; i >= 0; --i) {
				if (f[i][s] != '.') {
					min = i+1;
					break;
				}
			}
			
			if (min >= h-1)
				dontDoThisStep = true;
			else {
				f[min][s] = (char)('0' + ball[1]);
				f[min+1][s] = (char)('0' + ball[0]);
			}
		}
		return f;
	}
	
	private void dfs(int x, int y, int mode) {
		if (used[x][y][mode])
			return;
		
		if (mode == 0)
			++curCnt;
		else {
			cnt[x][y] = curCnt;
		}
		
		used[x][y][mode] = true;
		for (int k = 0; k < 4; ++k) {
			if (x+dx[k] >= 0 && x+dx[k] < h && y+dy[k] >= 0 && y+dy[k] < w) {
				if (f[x][y] == f[x+dx[k]][y+dy[k]]) {
					dfs(x+dx[k], y+dy[k], mode);
				}
			}
		}
	}
	
	int[] dx = {-1, 0, 1, 0};
	int[] dy = {0, -1, 0, 1};
	int[][] cnt;
	boolean[][][] used;
	char[][] f;
	int curCnt;
	boolean filling;
	int compCnt;
	int ptsCur;
	boolean dontDoThisStep;
	int blackBallsRemovedHere;
	
	 private void removeBlack() {
		for (int i = 0; i < h; ++i) {
			for (int j = 0; j < w; ++j) {
				if (f[i][j] == '*') {
					
					boolean del = false;
					for (int k = 0; k < 4; ++k) {
						if (i+dx[k]>= 0 && i+dx[k] < h && j+dy[k] >= 0 && j+dy[k] < w) {
							if (cnt[i+dx[k]][j+dy[k]] >= 4) {
								del = true;
							}
						}
					}
					
					if (del) {
						f[i][j] = '.';
						++blackBallsRemovedHere;
					}
				}
			}
		}
	}
	
	private void removeColors() {
		for (int i = 0; i < h; ++i) {
			for (int j = 0; j < w; ++j) {
				if (cnt[i][j] >= 4) {
					f[i][j] = '.';
				}
			}
		}
	}
	
	private void goDown() {
		for (int j = 0; j < w; ++j) {
			int cnt = 0;
			for (int i = 0; i < h; ++i) {
				if (f[i][j] == '.') {
					++cnt;
				}
				else {
					f[i-cnt][j] = f[i][j];
					f[i][j] = '.';
				}
			}
		}
	}
	
	int[] additionalForLavina = {0, 0, 3, 6, 12, 24, 50, 100};
	int removeLavinas(int deep) {
		int tmp = 0;
		cnt = new int[h][w];
		used = new boolean[h][w][2];
		
		for (int i = 0; i < h; ++i) {
			Arrays.fill(cnt[i], 0);
		}
		
		
		int comps = 0;
		int total = 0;
		int allComps = 0;
		for (int i = 0; i < h; ++i) {
			for (int j = 0; j < w; ++j) {
				if (f[i][j] != '.' && f[i][j] != '*' && cnt[i][j] == 0) {
					curCnt = 0;
					dfs(i, j, 0);
					dfs(i, j, 1);
					
					++allComps;
					if (curCnt >= 4) {
						++comps;
						total += curCnt;
					}
				}
			}
		}
		
		removeColors();
		removeBlack();
		goDown();
		
		
		
		cnt = new int[h][w];
		used = new boolean[h][w][2];
		
		for (int i = 0; i < h; ++i) {
			Arrays.fill(cnt[i], 0);
		}
		int openComp = 0;
		for (int i = 0; i < h; ++i) {
			for (int j = 0; j < w; ++j) {
				if (f[i][j] != '.' && f[i][j] != '*' && cnt[i][j] == 0) {
					boolean emptyNeighbour = false;
					for (int k = 2; k < 2; ++k) {
						if (i+dx[k]>= 0 && i+dx[k] < h && j+dy[k] >= 0 && j+dy[k] < w) {
							if (f[i+dx[k]][j+dy[k]] == '.') {
								emptyNeighbour = true;
							}
						}
					}
					
					if (emptyNeighbour) {
						curCnt = 0;
						dfs(i, j, 0);
						dfs(i, j, 1);
						
						++openComp;
					}
				}
			}
		}
		
		
		int res = 0;
		if (total > 0) {
			if (deep >= 7)
				deep = 6;
			res += removeLavinas(deep+1);
		}
		else {
			return additionalForLavina[deep]*1000000 + (200 - allComps)*10000 + (10 - openComp)*100;
		}
		
		return (total - comps - 2)*1000000 + blackBallsRemovedHere + res;
	}
	
	
	private void makeStep(char[][] field) {
		logField(field);
		ArrayList<Integer> allS = new ArrayList<Integer>();
		ArrayList<Integer> allR = new ArrayList<Integer>();
		int bestPt = -1;
		bestS = 0;
		bestR = 0;
		int[] ball = nextBall();
		for (int i = 0; i < 8; ++i) {
			for (int j = 0; j < 4; ++j) {
				if (i < 7 || j%2 != 0) {
					blackBallsRemovedHere = 0;
					dontDoThisStep = false;
					f = fall(field, i, j, ball.clone());
					if (dontDoThisStep)
						continue;
					int pts = removeLavinas(0);
					
					log("" + pts);
					if (pts > bestPt) {
						allS.clear();
						allR.clear();
						bestPt = pts;
						bestS = i;
						bestR = j;
						
						allS.add(i);
						allR.add(j);
						
						log("" + pts + " selected " +  i + " " + j);
						log("");
					}
					else if (pts == bestPt) {
						allS.add(i);
						allR.add(j);
					}
				}
			}
			
		}
		
		if (allS.size() > 0) {
			int cc = (int)(Math.random() * allS.size());
			bestS = allS.get(cc);
			bestR = allR.get(cc);
		}
		else {
			bestS = 0;
			bestR = 0;
		}
	}
	
	private void log(String s) {
	//	logger.println(s);
	//	logger.flush();
	}
	
	private void logField(char[][] ff) {
		//for (int i = 0; i < h; ++i) {
		//	logger.println(String.copyValueOf(ff[i]));
		//}
		//logger.println();
		//logger.flush();
	}
	
	int bestS;
	int bestR;
	char[][] ourField;
	 long x0;
	int h, w;
	static PrintWriter logger;
	public static void main(String[] args) throws IOException 
	{
		//logger = new PrintWriter("long.txt");
		(new SampleBot()).run();
		
	}
}
