/*------------------------------------------------------------
TEAM30
A
235
Target: Java6; Platform: Win32; Comment: Java (JDK 6)
------------------------------------------------------------*/
import java.io.*;
import java.util.*;
import java.math.*;

public class Biathlon {

	public static void main(String[] args) throws Throwable {
		new Biathlon().run();
	}

	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	boolean eof = false;
	Random rand = new Random(91321234);

	// PrintWriter log;

	private void run() throws Throwable {
		Locale.setDefault(Locale.US);
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		// log = new PrintWriter("game.log2");
		solve();
		out.close();
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return "0";
			}
		}
		return st.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	private static final String megasuperpuperlongname = "Winter Olympics";

	int[][] tab = new int[8][8];
	boolean[][] good = new boolean[8][8];
	{
		for (int i = 0; i < 8; i++) {
			tab[i][0] = 1;
			tab[i][1] = 1;
			tab[i][6] = -1;
			tab[i][7] = -1;
		}
	}

	int ourColor = -1;
	int ourCnt = 16;
	Brain pinky;
	Macho[] a;

	private void solve() throws IOException {
		pinky = new Brain();
		a = new Macho[16];
		for (int j = 0; j < a.length; j++) {
			a[j] = new Macho(j % 8, j / 8, j);
		}
		pinky.addSquad(new Attack(a[0], a[8]));
		pinky.addSquad(new Attack(a[3], a[11]));
		pinky.addSquad(new Attack(a[7], a[15]));
		pinky.addSquad(new Attack(a[4], a[12]));
		pinky.addSquad(new Defence(a[1], a[2], a[9], a[10]));
		pinky.addSquad(new Defence(a[5], a[6], a[13], a[14]));
		int turn = 0;
		while (true) {
			String s = nextToken();
			if ("Name".equals(s)) {
				out.println(megasuperpuperlongname);
			} else if ("Quit".equals(s)) {
				return;
			} else {
				if ("Start".equals(s)) {
					ourColor = 1;
				} else {
					makeTurn(s);
				}
				turn++;
				if (turn % 10 == 0) {
					shuffle();
				}
				try {
					out.println(pinky.makeStep());
				} catch (Throwable e) {
					// log.println(e.getMessage());
					// log.flush();
				}
			}
			out.flush();
		}
	}

	private void shuffle() {
		ArrayList<Macho> al = new ArrayList<Macho>();
		for (Macho m : a) {
			if (m.x >= 0) {
				al.add(m);
			}
		}
		Collections.sort(al);
		Brain tmp = pinky;
		try {
			HashSet<Macho> hs = new HashSet<Macho>();
			for (Squad s : pinky.sl) {
				if ((s instanceof Attack)) {
					for (Macho m : ((Attack) s).machos) {
						if (m.x >= 0) {
							hs.add(m);
						}
					}
				}
				if ((s instanceof Winner)) {
					for (Macho m : ((Winner) s).machos) {
						if (m.x >= 0) {
							hs.add(m);
						}
					}
				}
			}
			int att = hs.size();
			// log.println("att = " + att);
			// log.flush();
			pinky = new Brain();
			if (att > 4) {
				at = new Macho[att];
				att = 0;
				for (Macho m : hs) {
					at[att++] = m;
				}
				for (Squad s : tmp.sl) {
					if ((s instanceof Defence)) {
						pinky.addSquad(s);
					}
				}
			} else {
				Macho[] def = new Macho[al.size() / 2];
				for (int i = 0; i < def.length; i++) {
					def[i] = al.get(i);
				}
				pinky.addSquad(new Defence(def));

				at = new Macho[al.size() - def.length];
				for (int i = def.length; i < al.size(); ++i) {
					at[i - def.length] = al.get(i);
				}
			}
			u = new boolean[at.length];
			p = new int[at.length];
			for (int i = 0; i < p.length; ++i) {
				p[i] = i;
			}
			trg = Integer.MAX_VALUE;
			bt(0);
			// log.println(Arrays.toString(ap));
			// log.flush();
			for (int i = 0; i < ap.length; ++i) {
				if (ap[i] < i)
					continue;
				if (ap[i] == i) {
					pinky.addSquad(new Attack(at[i]));
				} else {
					pinky.addSquad(new Attack(at[i], at[ap[i]]));
				}
			}
		} catch (Throwable e) {
			// log.println(e.getMessage());
			// log.flush();
			pinky = tmp;
		}
	}

	Macho[] at;

	boolean[] u;
	int[] p, ap;
	int trg;

	void bt(int i) {
		if (i == u.length) {
			int t = 0;
			for (int j = 0; j < p.length; ++j) {
				if (j == p[j]) {
					t += 1000;
				} else {
					t += Math.abs(at[j].x - at[p[j]].x)
							+ Math.abs(at[j].y - at[p[j]].y);
				}
			}
			if (t < trg) {
				ap = p.clone();
			}
		} else {
			if (u[i]) {
				bt(i + 1);
			} else {
				for (int j = i; j < u.length; ++j) {
					if (u[j])
						continue;
					p[i] = j;
					p[j] = i;
					u[i] = true;
					u[j] = true;
					bt(i + 1);
					u[j] = false;
					u[i] = false;
					p[j] = j;
				}
			}
		}
	}

	private void makeTurn(String s) {
		int sx = s.charAt(0) - 'a';
		int sy = s.charAt(1) - '1';
		int fx = s.charAt(2) - 'a';
		int fy = s.charAt(3) - '1';
		if (ourColor == -1) {
			sx = 7 - sx;
			sy = 7 - sy;
			fx = 7 - fx;
			fy = 7 - fy;
		}
		if (tab[fx][fy] == 1) {
			ourCnt--;
		}
		tab[fx][fy] = -1;
		tab[sx][sy] = 0;
	}

	String ourTurn(int sx, int sy, int fx, int fy) {
		// tab[fx][fy] = 1;
		// tab[sx][sy] = 0;
		if (ourColor == -1) {
			sx = 7 - sx;
			sy = 7 - sy;
			fx = 7 - fx;
			fy = 7 - fy;
		}
		String ans = "" + (char) ('a' + sx) + (char) ('1' + sy)
				+ (char) ('a' + fx) + (char) ('1' + fy);
		// log.println(ans);
		// log.flush();
		return ans;
	}

	class Macho implements Comparable<Macho> {
		int x, y, num;

		public Macho(int x, int y, int num) {
			this.x = x;
			this.y = y;
			this.num = num;
		}

		@Override
		public int compareTo(Macho o) {
			return y - o.y;
		}
	}

	interface Squad {
		public ArrayList<Move> makeStep();
	}

	final int SIZE = 8;

	class Move {
		public Move(String ss, int i, Macho m) {
			s = ss;
			val = i;
			this.m = m;
		}

		String s;
		int val;
		Macho m;
	}

	class Attack implements Squad {

		Macho[] machos;

		public Attack(Macho... m) {
			this.machos = m.clone();
		}

		@Override
		public ArrayList<Move> makeStep() {
			for (Macho m : machos) {
				if (tab[m.x][m.y] <= 0) {
					m.x = -1;
					Macho[] n = new Macho[machos.length - 1];
					int k = 0;
					for (Macho mm : machos) {
						if (mm != m) {
							n[k++] = mm;
						}
					}
					machos = n;
					break;
				}
			}
			ArrayList<Move> al = new ArrayList<Move>();
			for (Macho m : machos) {
				for (int k = -1; k < 2; k++) {
					int max = 0;
					for (Macho m2 : machos) {
						if (m2.y <= m.y) {
							max = Math.max(max, Math.abs(m.x + k - m2.x)
									+ Math.abs(m.y + 1 - m2.y));
						}
					}
					max -= 5;
					switch (checkMove(m.x, m.y, m.x + k, m.y + 1)) {
					case -2:
						al.add(new Move(ourTurn(m.x, m.y, m.x + k, m.y + 1),
								-1, m));
						break;
					case -1:
						break;
					case 0:
						al.add(new Move(ourTurn(m.x, m.y, m.x + k, m.y + 1),
								(3 * m.y - 4 * max), m));
						break;
					case 1:
						al.add(new Move(ourTurn(m.x, m.y, m.x + k, m.y + 1),
								100 - 2 * (7 - m.y) + 1, m));
						break;
					case 2:
						pinky.addSquad(new Winner(m));
						break;
					default:
						break;
					}
				}
			}
			return al;
		}
	}

	class Winner implements Squad {

		Macho[] machos;

		public Winner(Macho... m) {
			this.machos = m.clone();
		}

		@Override
		public ArrayList<Move> makeStep() {
			for (Macho m : machos) {
				if (tab[m.x][m.y] <= 0) {
					m.x = -1;
					Macho[] n = new Macho[machos.length - 1];
					int k = 0;
					for (Macho mm : machos) {
						if (mm != m) {
							n[k++] = mm;
						}
					}
					machos = n;
					break;
				}
			}
			ArrayList<Move> al = new ArrayList<Move>();
			for (Macho m : machos) {
				for (int k = -1; k < 2; k++) {
					// max *= max;
					switch (checkMove(m.x, m.y, m.x + k, m.y + 1)) {
					case -2:
						al.add(new Move(ourTurn(m.x, m.y, m.x + k, m.y + 1),
								-1, m));
						break;
					case -1:
						break;
					case 0:
						al.add(new Move(ourTurn(m.x, m.y, m.x + k, m.y + 1),
								2 * m.y, m));
						break;
					case 1:
						al.add(new Move(ourTurn(m.x, m.y, m.x + k, m.y + 1),
								100 - 2 * (7 - m.y) + 1, m));
						break;
					case 2:
						al.add(new Move(ourTurn(m.x, m.y, m.x + k, m.y + 1),
								202 - (7 - m.y), m));
						break;
					default:
						break;
					}
				}
			}
			return al;
		}
	}

	class Defence implements Squad {

		Macho[] machos;

		public Defence(Macho... m) {
			this.machos = m.clone();
		}

		@Override
		public ArrayList<Move> makeStep() {
			for (Macho m : machos) {
				if (tab[m.x][m.y] <= 0) {
					m.x = -1;
					Macho[] n = new Macho[machos.length - 1];
					int k = 0;
					for (Macho mm : machos) {
						if (mm != m) {
							n[k++] = mm;
						}
					}
					machos = n;
					break;
				}
			}
			ArrayList<Move> al = new ArrayList<Move>();
			for (Macho m : machos) {
				for (int k = -1; k < 2; k++) {
					switch (checkMove(m.x, m.y, m.x + k, m.y + 1)) {
					case -2:
						al.add(new Move(ourTurn(m.x, m.y, m.x + k, m.y + 1),
								-2, m));
						break;
					case -1:
						break;
					case 0:
						al.add(new Move(ourTurn(m.x, m.y, m.x + k, m.y + 1),
								-1, m));
						break;
					case 1:
						al.add(new Move(ourTurn(m.x, m.y, m.x + k, m.y + 1),
								200 - 2 * m.y, m));
						break;
					case 2:
						pinky.addSquad(new Winner(m));
						break;
					default:
						break;
					}
				}
			}
			return al;
		}

	}

	int checkMove(int x1, int y1, int x2, int y2) {
		if (x1 < 0 || SIZE <= x1)
			return -1;
		if (x2 < 0 || SIZE <= x2)
			return -1;
		if (y1 < 0 || SIZE <= y1)
			return -1;
		if (y2 < 0 || SIZE <= y2)
			return -1;
		if (y2 != y1 + 1) {
			return -1;
		}
		if (Math.abs(x1 - x2) > 1) {
			return -1;
		}
		if (tab[x2][y2] > 0 || (x2 == x1 && tab[x2][y2] != 0)) {
			return -1;
		}
		if (tab[x1][y1] <= 0)
			return -1;
		if (tab[x2][y2] == 0
				&& (y2 + 1 < SIZE && ((x2 - 1 >= 0 && tab[x2 - 1][y2 + 1] < 0) || (x2 + 1 < SIZE && tab[x2 + 1][y2 + 1] < 0))))
			return -2;
		if (good[x2][y2]) {
			return 2;
		}
		return -tab[x2][y2];
	}

	class Brain {
		ArrayList<Squad> sl = new ArrayList<Squad>();

		public void addSquad(Squad s) {
			sl.add(s);
		}

		public String makeStep() {
			for (int i = 0; i < good.length; i++) {
				Arrays.fill(good[i], true);
			}
			for (int i = 0; i < good.length; i++) {
				for (int j = 0; j < good[i].length; j++) {
					for (int i1 = 0; i1 < good.length; i1++) {
						for (int j1 = 0; j1 < good[i1].length; j1++) {
							if (tab[i1][j1] < 0 && Math.abs(i1 - i) <= j1 - j
									&& (i != i1 || j != j1)) {
								good[i][j] = false;
							}
						}
					}
				}
			}
			ArrayList<Move> l = new ArrayList<Move>();
			for (int i = 0; i < sl.size(); i++) {
				Squad s = sl.get(i);
				l.addAll(s.makeStep());
			}
			// for (Move m : l) {
			// System.err.println(m.s + " " + m.val);
			// }
			Collections.shuffle(l);
			Move best = null;
			for (Move m : l) {
				if (best == null || best.val < m.val) {
					best = m;
				}
			}
			makeMove(best);
			// log.println(best.s + " " + best.val);
			// log.flush();
			return best.s;
		}

		private void makeMove(Move m) {
			String s = m.s;
			int sx = s.charAt(0) - 'a';
			int sy = s.charAt(1) - '1';
			int fx = s.charAt(2) - 'a';
			int fy = s.charAt(3) - '1';
			if (ourColor == -1) {
				sx = 7 - sx;
				sy = 7 - sy;
				fx = 7 - fx;
				fy = 7 - fy;
			}
			tab[fx][fy] = 1;
			tab[sx][sy] = 0;
			m.m.x = fx;
			m.m.y = fy;
		}
	}
}
