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

public class chess_pk {

	private Scanner in;

	void solve() {
		in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int k = in.nextInt();
		int b = in.nextInt();
		int x = in.nextInt();
		int y = in.nextInt();
		if (k > 100 || k < 3) {
			throw new AssertionError();
		}
		if (b < 1 || b > k) {
			throw new AssertionError();
		}
		if (x < 1 || x > k) {
			throw new AssertionError();
		}
		if (y < 1 || y > k) {
			throw new AssertionError();
		}
		if (x == 1 && y == b) {
			throw new AssertionError();
		}
		for (int i = 2; i <= k; i++) {
			if (b > 1 && ((i + b - 1) % 2 != (x + y) % 2)) {
				out.println(i + " " + (b - 1));

			} else if ((i + b) % 2 != (x + y) % 2) {
				out.println(i + " " + b);
			} else {
				out.println(i + " " + (b + 1));
			}
			out.flush();
			if (i != k) {
				int tx = in.nextInt();
				int ty = in.nextInt();
				if (Math.abs(tx - x) != Math.abs(ty - y)) {
					throw new AssertionError();
				}
				if (tx < 1 || tx > k || ty < 1 || ty > k) {
					throw new AssertionError();
				}
				x = tx;
				y = ty;
			}
		}
		in.close();
		out.close();
	}

	public static void main(String[] args) throws FileNotFoundException {
		new chess_pk().solve();
	}
}
