import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;

public class Interact {
	public static void main(String[] args) throws FileNotFoundException {
		new Interact().run();
	}

	int k;

	private void run() throws FileNotFoundException {
		in = new Scanner(System.in);
		test = new Scanner(new File("chess.in"));
		k = test.nextInt();
		int b = test.nextInt();
		int x = test.nextInt();
		int y = test.nextInt();
		String stategy = test.next();
		int a = 1;

		rnd = new Random(31 + k - b);

		PrintWriter out = new PrintWriter(System.out);
		out.println(k);
		out.println(b);
		out.println(x + " " + y);
		out.flush();

		int cnt = 0;
		while (true) {
			int na, nb;
			try {
				na = in.nextInt();
				nb = in.nextInt();
			} catch (Exception e) {
				PE("Something strange instead of coordinates");
				return;
			}
			if (Math.abs(na - a) > 1 || Math.abs(nb - b) > 1
					|| (na == a && nb == b)) {
				WA("Simba broke some rules");
			}
			if (na == k) {
				OK();
			}
			if (Math.abs(na - x) == Math.abs(nb - y)) {
				WA("Simba is dead now");
			}
			a = na;
			b = nb;

			int[] tmp = nextMove(a, b, x, y, stategy);
			x = tmp[0];
			y = tmp[1];
			out.println(x + " " + y);
			out.flush();
			cnt++;
			if (cnt > 1001) {
				WA("Too many turns");
			}
		}
	}

	Random rnd;
	private Scanner test;
	private Scanner in;

	private int[] nextMove(int a, int b, int x, int y, String strategy) {
		int[] res = new int[] { x, y };
		int[] part = new int[] { a, b };
		if (strategy.equals("random")) {
			return getRandomMove(res);

		}

		if (strategy.equals("nearest")) {
			ArrayList<int[]> candidates = new ArrayList<int[]>();
			for (int d = 0; d < 8; d++) {
				for (int di = -1; di < 2; di += 2) {
					for (int dj = -1; dj < 2; dj += 2) {
						int[] tmp = res.clone();
						tmp[0] += di * d;
						tmp[1] += dj * d;
						if (!inBounds(tmp)) {
							continue;
						}
						if (candidates.size() == 0
								|| dist(new int[] { a, b }, tmp) == dist(
										new int[] { a, b }, candidates.get(0))) {
							candidates.add(tmp);
						}
						if (dist(new int[] { a, b }, tmp) < dist(new int[] { a,
								b }, candidates.get(0))) {
							candidates = new ArrayList<int[]>();
							candidates.add(tmp);
						}
					}
				}
			}
			return candidates.get(rnd.nextInt(candidates.size()));
		}

		if (strategy.equals("check")) {
			ArrayList<int[]> candidates = new ArrayList<int[]>();
			for (int d = 0; d < 8; d++) {
				for (int di = -1; di < 2; di += 2) {
					for (int dj = -1; dj < 2; dj += 2) {
						int[] tmp = res.clone();
						tmp[0] += di * d;
						tmp[1] += dj * d;
						if (!inBounds(tmp)) {
							continue;
						}
						if (canMove(part, tmp)) {
							candidates.add(tmp);
						}
					}
				}

			}
			if (candidates.size() >= 1) {
				return candidates.get(rnd.nextInt(candidates.size()));
			} else {
				return getRandomMove(res);

			}
		}

		if (strategy.equals("camperOne")) {
			ArrayList<int[]> candidates = new ArrayList<int[]>();
			for (int d = 0; d < 8; d++) {
				for (int di = -1; di < 2; di += 2) {
					for (int dj = -1; dj < 2; dj += 2) {
						int[] tmp = res.clone();
						tmp[0] += di * d;
						tmp[1] += dj * d;
						if (!inBounds(tmp)) {
							continue;
						}
						if (di == dj)
							continue;
						candidates.add(tmp);
					}
				}
			}
			return candidates.get(rnd.nextInt(candidates.size()));
		}

		if (strategy.equals("camperTwo")) {
			ArrayList<int[]> candidates = new ArrayList<int[]>();
			for (int d = 0; d < 8; d++) {
				for (int di = -1; di < 2; di += 2) {
					for (int dj = -1; dj < 2; dj += 2) {
						int[] tmp = res.clone();
						tmp[0] += di * d;
						tmp[1] += dj * d;
						if (!inBounds(tmp)) {
							continue;
						}
						if (di != dj)
							continue;
						candidates.add(tmp);
					}
				}
			}
			return candidates.get(rnd.nextInt(candidates.size()));
		}

		if (strategy.equals("before")) {
			ArrayList<int[]> candidates = new ArrayList<int[]>();
			for (int d = 0; d < 8; d++) {
				for (int di = -1; di < 2; di += 2) {
					for (int dj = -1; dj < 2; dj += 2) {
						int[] tmp = res.clone();
						tmp[0] += di * d;
						tmp[1] += dj * d;
						if (!inBounds(tmp)) {
							continue;
						}
						if (tmp[0] != part[0] + 1) {
							continue;
						}
						if (candidates.size() == 0
								|| dist(new int[] { a, b }, tmp) == dist(
										new int[] { a, b }, candidates.get(0))) {
							candidates.add(tmp);
						}
						if (dist(new int[] { a, b }, tmp) < dist(new int[] { a,
								b }, candidates.get(0))) {
							candidates = new ArrayList<int[]>();
							candidates.add(tmp);
						}
					}
				}
			}
			if (candidates.size() >= 1) {
				return candidates.get(rnd.nextInt(candidates.size()));
			} else {
				return getRandomMove(res);

			}
		}
		throw new AssertionError();
	}

	private boolean canMove(int[] part, int[] tmp) {
		return xDist(tmp, part) == yDist(tmp, part);
	}

	private int xDist(int[] a, int[] b) {
		return Math.abs(a[0] - b[0]);
	}

	private int yDist(int[] a, int[] b) {
		return Math.abs(a[1] - b[1]);
	}

	private int[] getRandomMove(int[] res) {
		ArrayList<int[]> candidates = new ArrayList<int[]>();
		for (int d = 0; d < 8; d++) {
			for (int di = -1; di < 2; di += 2) {
				for (int dj = -1; dj < 2; dj += 2) {
					int[] tmp = res.clone();
					tmp[0] += di * d;
					tmp[1] += dj * d;
					if (!inBounds(tmp)) {
						continue;
					}
					candidates.add(tmp);

				}
			}
		}
		return candidates.get(rnd.nextInt(candidates.size()));

	}

	private boolean inBounds(int[] a) {
		for (int i = 0; i < 2; i++) {
			if (a[i] < 1 || a[i] > k)
				return false;
		}
		return true;
	}

	private int dist(int[] a, int[] b) {
		return xDist(a, b) + yDist(a, b);
	}

	private void OK() throws FileNotFoundException {
		PrintWriter out = new PrintWriter("chess.out");
		out.println("OK");
		out.close();
		System.exit(0);
	}

	private void WA(String c) throws FileNotFoundException {
		PrintWriter out = new PrintWriter("chess.out");
		out.println("WA");
		out.println(c);
		out.close();
		System.exit(10);
	}

	private void PE(String c) throws FileNotFoundException {
		PrintWriter out = new PrintWriter("chess.out");
		out.println("PE");
		out.println(c);
		out.close();
		System.exit(10);
	}
}
