#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <limits>
#include <functional>
#include <map>
#include <vector>
#include <stack>
#include <list>
#include <string>
#include <sstream>
#include <cmath>
#include <stdint.h>
#include <iomanip>
#include <utility>
#include <cassert>

using namespace std;

template <typename T>
T tabs(const T &x)
{
	if (x<0)
		return -x;
	return x;
}

template <typename T>
T next(T x)
{
	return (x*17235617+4311271)%87465851;
}

struct field
{
	char data[16][8];
};

istream &operator>>(istream &in, field &f)
{
	for (size_t i = 0; i<16; ++i)
		for (size_t j = 0; j<8; ++j)
			in>>f.data[i][j];
	return in;
}

enum prior
{
	possib,
	del,
	bdel,
	tern,
	bin,
	score,
	height,
	_last
};

bool install(field &f, unsigned pos, char c)
{
	for (unsigned i = 15; i<16; --i)
		if (f.data[i][pos]=='.')
		{
			f.data[i][pos] = c;
			return true;
		}
	return false;
}

template <typename T>
char color(T x)
{
	return static_cast<char>((x%5)+'1');
}

typedef pair<size_t, size_t> repr;
typedef vector<repr> gdsu_t;
typedef vector<gdsu_t> dsu_t;

repr get_parent(dsu_t &dsu, const repr &r)
{
	if (r==dsu[r.first][r.second])
		return r;
	return dsu[r.first][r.second] = get_parent(dsu, dsu[r.first][r.second]);
}

void unite(dsu_t &dsu, const repr &a, const repr &b)
{
	get_parent(dsu, a);
	get_parent(dsu, b);
	if (rand()&1)
		dsu[dsu[a.first][a.second].first][dsu[a.first][a.second].second] = dsu[b.first][b.second];
	else
		dsu[dsu[b.first][b.second].first][dsu[b.first][b.second].second] = dsu[a.first][a.second];
}

bool process(vector<int> &nr, const pair<unsigned long long, unsigned long long> &x, const field &our, const field &enemy, const unsigned s, const unsigned r)
{
	field no = our;
	nr.resize(_last);
	fill(nr.begin(), nr.end(), 0);
	//install
	switch (r)
	{
	case 0:
		if (s==7)
			return false;
		nr[possib] = install(no, s, color(x.first)) && install(no, s+1, color(x.second));
		break;
	case 1:
		nr[possib] = install(no, s, color(x.second)) && install(no, s, color(x.first));
		break;
	case 2:
		if (s==0)
			return false;
		nr[possib] = install(no, s, color(x.first)) && install(no, s-1, color(x.second));
		break;
	case 3:
		nr[possib] = install(no, s, color(x.first)) && install(no, s, color(x.second));
		break;
	default:
		assert(false);
	}
	//end_install
	if (!nr[possib])
		return true;
	bool changed;
	size_t iter_done = 0;
	do
	{
		changed = false;
		//build dsu
		dsu_t dsu(16, gdsu_t(8));
		for (size_t i = 0; i<16; ++i)
			for (size_t j = 0; j<8; ++j)
				dsu[i][j] = make_pair(i, j);
		for (size_t i = 0; i<16; ++i)
			for (size_t j = 0; j<8; ++j)
				if (no.data[i][j]!='.')
				{
					if (i)
						if (no.data[i][j]==no.data[i-1][j])
							unite(dsu, make_pair(i, j), make_pair(i-1, j));
					if (j)
						if (no.data[i][j]==no.data[i][j-1])
							unite(dsu, make_pair(i, j), make_pair(i, j-1));
				}
		//end_build
		map<pair<size_t, size_t>, size_t> fcount;
		for (size_t i = 0; i<16; ++i)
			for (size_t j = 0; j<8; ++j)
			{
				pair<size_t, size_t> rpr = get_parent(dsu, make_pair(i, j));
				auto iter = fcount.find(rpr);
				if (iter==fcount.end())
					fcount[rpr] = 1;
				else
					++(iter->second);
			}
		//delete 4 or gr+black
		vector<vector<bool> > to_del(16, vector<bool>(8, false));
		nr[tern] = 0;
		nr[bin] = 0;
		for (auto iter = fcount.begin(); iter!=fcount.end(); ++iter)
		{
			if (iter->second>=4 && no.data[iter->first.first][iter->first.second]!='*')
			{
				nr[score]+=iter->second-1;
				for (size_t i = 0; i<16; ++i)
					for (size_t j = 0; j<8; ++j)
						if (dsu[i][j]==iter->first)
							to_del[i][j] = true;
						else if (no.data[i][j]=='*')
						{
							if (i)
							{
								if (dsu[i-1][j]==iter->first)
									to_del[i][j] = true;
							}
							if (i+1<16)
							{
								if (dsu[i+1][j]==iter->first)
									to_del[i][j] = true;
							}
							if (j)
							{
								if (dsu[i][j-1]==iter->first)
									to_del[i][j] = true;
							}
							if (j+1<8)
							{
								if (dsu[i][j+1]==iter->first)
									to_del[i][j] = true;
							}
						}
			}
			else if (iter->second==3 && no.data[iter->first.first][iter->first.second]!='*')
				++nr[tern];
			else if (iter->second==2 && no.data[iter->first.first][iter->first.second]!='*')
				++nr[bin];
		}
		for (size_t i = 0; i<16; ++i)
			for (size_t j = 0; j<8; ++j)
				if (to_del[i][j])
				{
					changed = true;
					++nr[del];
					if (no.data[i][j]=='*')
						++nr[bdel];
					no.data[i][j] = '.';
				}
		if (changed)
		{
			++iter_done;
			nr[score]-=2;
		}
		//end_delete
		//reinstall
		for (size_t j = 0; j<8; ++j)
		{
			size_t i = 15, l = 16;
			while (i<16)
			{
				if (no.data[i][j]!='.')
				{
					--l;
					swap(no.data[l][j], no.data[i][j]);
				}
				--i;
			}
		}
		//end_reinstall
	}
	while (changed);
	switch (iter_done)
	{
	case 0:
		break;
	case 1:
		break;
	case 2:
		nr[score]+=3;
		break;
	case 3:
		nr[score]+=6;
		break;
	case 4:
		nr[score]+=12;
		break;
	case 5:
		nr[score]+=24;
		break;
	case 6:
		nr[score]+=50;
		break;
	default:
		nr[score]+=100;
		break;
	}
	nr[height] = 0;
	for (size_t j = 0; j<8; ++j)
		for (size_t i = 0; i<16; ++i)
			if (no.data[i][j]!='.')
			{
				if (16-i>nr[height])
					nr[height] = 16-i;
				break;
			}
	nr[height]*=-1;
	return true;
}

void generate(const pair<unsigned long long, unsigned long long> &x, const field &our, const field &enemy, unsigned &s, unsigned &r)
{
	vector<int> result(_last, 0);
	bool found = false;
	for (int i = 0; i<=7; ++i)
		for (int j =0; j<4; ++j)
		{
			vector<int> nr(_last, 0);
			if (process(nr, x, our, enemy, i, j))
			{
				found = true;
				if (result<=nr)
				{
					result = nr;
					s = i;
					r = j;
				}
			}
		}
	assert(found);
}

int main()
{
	//freopen("proto.txt", "r", stdin);
	std::ios_base::sync_with_stdio(false);
	string line;
	pair<unsigned long long, unsigned long long> x;
	while (cin>>line)
	{
		if (line=="Start")
		{
			cin>>x.first;
			x.second = next(x.first);
			cout<<"Izengard"<<endl;
		}
		else if (line=="Quit")
		{
			return 0;
		}
		else if (line=="Move")
		{
			x.first = next(x.second);
			x.second = next(x.first);
			field our, enemy;
			cin>>our>>enemy;
			unsigned s, r;
			generate(x, our, enemy, s, r);
			cout<<s<<' '<<r<<endl;
		}
		else
		{
			assert(false);
		}
		cout.flush();
	}
}
