#include <cstdio>
#include <cstring>
#include <cstring>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iostream>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define For(i, a, b) for(int i = a; i < b; i++)
#define all(a) a.begin(), a.end()
#define sz(a) ((int)a.size())

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef long long lint;

const int Size = 10000;
char buffer[Size];

int x0, x1;
int c0, c1;
const int C = 8, R = 16;
int enemy[R][C];
const int black = 6;
int ar[R][C];

int mod(lint x, int n) {
	int res = x % n;
	if(res < 0)
		res += n;
	return res;
}

int getNextX(int xi) {
	return mod(((lint)xi * 17235617 + 4311271), 87465851);
}

void updateX() {
	x0 = getNextX(x1);
	c0 = x0 % 5 + 1;
	x1 = getNextX(x0);
	c1 = x1 % 5 + 1;
}

void read() {
	for(int i = R - 1; i >= 0; i--) {
		gets(buffer);
		For(j, 0, C) {
			char t = buffer[j];
			if(t == '.') {
				ar[i][j] = 0;
			}
			else
			if(t == '*') {
				ar[i][j] = black;
			}
			else {
				ar[i][j] = t - '0';
			}
		}
	}

	gets(buffer);

	for(int i = R - 1; i >= 0; i--) {
		gets(buffer);
		For(j, 0, C) {
			char t = buffer[j];
			if(t == '.') {
				enemy[i][j] = 0;
			}
			else
			if(t == '*') {
				enemy[i][j] = black;
			}
			else {
				enemy[i][j] = t - '0';
			}
		}	
	}
}

vector<int> getCountInColumn() {
	vector<int> height(C, 0);
	For(j, 0, C) {
		for(int i = R - 1; i >= 0; i--) {
			if(ar[i][j] != 0) {
				height[j]++;
			}
		}
	}
	return height;
}


vector<pii> getTop() {
	vector<pii> top(C, mp(0, 0));//color, count second same color height
	For(j, 0, C) {
		for(int i = R - 1; i >= 0; i--) {
			if(ar[i][j] != 0) {
				if(top[j].first != 0) {
					if(top[j].first == ar[i][j]) {
						top[j].second++;
					}
					else {
						break;
					}
				}
				else {					
					top[j] = mp(ar[i][j], 1);
				}
			}
		}
	}
	return top;
}

bool findTop() {
	vector<pii> top = getTop();
	vi h = getCountInColumn();

	pii x = mp(c0, c1);
	bool wasSwap = false;
	pii maxElement = mp(0, 0); //max , ind
	For(j, 0, C-1) {
		if(x.first == top[j].first && x.second == top[j+1].first) {
			if(h[j] == R - 1 || h[j+1] == R - 1) {
				continue;
			}
			int sum = max(top[j].second, top[j+1].second);
			maxElement = max(mp(sum, j), maxElement);			
		}
	}
	swap(x.first, x.second);
	For(j, 0, C-1) {
		if(x.first == top[j].first && x.second == top[j+1].first) {
			if(h[j] == R - 1 || h[j+1] == R - 1) {
				continue;
			}
			int sum = max(top[j].second, top[j+1].second);
			if(maxElement < mp(sum, j)) {
				maxElement = max(mp(sum, j), maxElement);
				wasSwap = true;
			}
		}
	}
	if(maxElement.first	> 0) {
		printf("%d ", maxElement.second);
		if(wasSwap)
			printf("%d", 2);
		else
			printf("%d", 0);
		printf("\n");
		return true;
	}
	return false;
}

bool findNeib() {
	vi height = getCountInColumn();

	pii x = mp(c0, c1);
	bool wasSwap = false;
	pair<int, pii> maxElement = mp(0, mp(0, 0)); //sum, heig , ind


	For(j, 0, C) {
		int sum = 0;
		int h = height[j];
		if(j > 0) {
			if(x.first == ar[h+1][j-1])
				sum++;
			if(x.second == ar[h][j-1])
				sum++;
		}
		if(j < C - 1) {
			if(x.first == ar[h+1][j+1])
				sum++;
			if(x.second == ar[h][j+1])
				sum++;
		}
		maxElement = max(maxElement, mp(sum, mp(h, j)));
	}

	swap(x.first, x.second);

	For(j, 0, C) {
		int sum = 0;
		int h = height[j];
		if(j > 0) {
			if(x.first == ar[h+1][j-1])
				sum++;
			if(x.second == ar[h][j-1])
				sum++;
		}
		if(j < C - 1) {
			if(x.first == ar[h+1][j+1])
				sum++;
			if(x.second == ar[h][j+1])
				sum++;
		}
		if(maxElement < mp(sum, mp(h, j))) {
			maxElement = max(maxElement, mp(sum, mp(h, j)));
			wasSwap = true;
		}
	}
	if(maxElement.first != 0) {
		printf("%d ", maxElement.second.second);
		if(wasSwap)
			printf("%d", 3);
		else
			printf("%d", 1);
		printf("\n");
		return true;
	}
	return false;
}


bool findMin() {
	vi h = getCountInColumn();
	int minElement = *min_element(all(h));
	For(j, 0, C) {
		if(minElement == h[j]) {
			printf("%d %d\n", j, 1);
			return true;
		}
	}
	printf("0 0\n");
	return true;
}

int tempAr[R][C];

void drop(int l, int r) {
	vi h = getCountInColumn();
	For(i, 0, R)
		For(j, 0, C)
			tempAr[i][j] = ar[i][j];

	if(r & 0x1) {
		if(r == 1)  {
			tempAr[h[l]][l] = c1;
			tempAr[h[l]+1][l] = c0;
		}
		else {
			tempAr[h[l]][l] = c0;
			tempAr[h[l]+1][l] = c1;
		}
	}
	else {
		if(r == 0)  {
			tempAr[h[l]][l] = c0;
			tempAr[h[l+1]][l+1] = c1;
		}
		else {
			tempAr[h[l]][l] = c1;
			tempAr[h[l+1]][l+1] = c0;
		}
	}
}

int color[R][C];

int dc[] = {-1, 0, 1, 0};
int dr[] = {0, 1, 0, -1};

int res = 0;
int resW = 0;
int startColor;


void dfsVisit(int ui, int uj) {
	if(tempAr[ui][uj] == startColor) {
		res++;
		resW++;
	}
	color[ui][uj] = 1;
	For(k, 0, 4) {
		int vi = ui + dr[k];
		int vj = uj + dc[k];
		if(vi >= R || vi < 0 || vj >= C || vj < 0)
			continue;

		if(color[vi][vj] == 1)
			continue;
		
		if(tempAr[vi][vj] == black)
			resW += 2;
		if(tempAr[vi][vj] == startColor)
			dfsVisit(vi, vj);
	}
}

set<pii> st;

int debugSum;

int dfsCalc() {
	bool flag = true;
	int sum = 0;
	vector<pii> del;
	while(flag) {
		int commonRes = 0;
	
		flag = false;
		For(i, 0, R) {
			For(j, 0, C) {
				color[i][j] = 0;
			}
		}

		int cc =0;
		For(i, 0, R) {
			For(j, 0, C) {
				if(color[i][j] == 0) {
					if(tempAr[i][j] == black || tempAr[i][j] == 0)
						continue;
					res = 0;
					resW = 0;
					startColor = tempAr[i][j];
					dfsVisit(i, j);
					if(res >= 4) {
						cc++;
						commonRes += res;
						del.pb(mp(i, j));
					}
				}
			}
		}

		commonRes = 0;
		cc = 0;
		For(i, 0, R) {
			For(j, 0, C) {
				color[i][j] = 0;
			}
		}

		
		For(it, 0, sz(del)) {
			int i = del[it].first;
			int j = del[it].second;
			if(color[i][j] == 0) {
				if(tempAr[i][j] == black || tempAr[i][j] == 0)
					continue;
				res = 0;
				resW = 0;
				startColor = tempAr[i][j];
				dfsVisit(i, j);
				if(res >= 4) {
					cc++;
					commonRes += resW;
				}
			}
		}

		sum += max(0, commonRes - cc - 2);
	}


	return sum;
}

bool brootForce() {
	int sum = 0;
	pii el = mp(0, 0);
	For(j, 0, C) {
		for(int k = 1; k < 4; k += 2) {
			drop(j, k);
			int t = dfsCalc();
			if(t > sum) {
				el = mp(j, k);
				sum = t;
			}
		}
	}

	For(j, 0, C-1) {
		for(int k = 0; k < 4; k += 2) {
			drop(j, k);
			int t = dfsCalc();
			if(t >= sum) {
				el = mp(j, k);
				sum = t;
			}
		}
	}
	debugSum = sum;

	if(sum > 0) {
		printf("%d %d\n", el.first, el.second);
		return true;
	}
	return false;
}


void debugOutput() {
	cerr << "color: " << c0 << " " << c1 << endl;
	cerr << "sum: " << debugSum << endl;
	vector<pii> top = getTop();
	For(j, 0, C) {
		cerr << "(" << top[j].first << "," << top[j].second << ") ";
	}
	cerr << endl;

	for(int i = R - 1; i >= 0; i--) {
		For(j, 0, C) {
			cerr << ar[i][j];
		}
		cerr << endl;
	}
	cerr << endl;
	vi h = getCountInColumn();
	For(j, 0, C) {
		cerr << h[j] << " ";
	}
	cerr << endl;
}



void calc() {
//	debugOutput();
	

	if(brootForce())
		return;
	if(findNeib())
		return;
	if(findTop())
		return;
//	if(findOnTop())
//		return;
	findMin();
}




int main() {
//	freopen("output.txt", "w", stderr);
	for(int i = 0 ; ; ++i) {
		char str[100];
		scanf("%s",str);
		gets(buffer);
		if(!strcmp(str,"Quit"))
		  break;
		if(!strcmp(str,"Start")) {
			scanf("%d", &x0);
			x1 = getNextX(x0);
			c0 = x0 % 5 + 1;
			c1 = x1 % 5 + 1;
			printf("SevereBot\n");
			fflush(stdout);
		}
		else
		if(!strcmp(str,"Move")) {
			read();
			calc();
			updateX();
			fflush(stdout);
		}
	}

	return 0;
}
