Problem: This is an interactive problem.

Vasya and Vitya play a game. Vasya thought of two integers a and b from 1 to n and Vitya tries to guess them. Each round he tells Vasya two numbers x and y from 1 to n. If both x=a and y=b then Vitya wins. Else Vasya must say one of the three phrases: 

  1. x is less than a; 
  2. y is less than b; 
  3. x is greater than a or y is greater than b. 



Vasya can't lie, but if multiple phrases are true, he may choose any of them. For example, if Vasya thought of numbers 2 and 4, then he answers with the phrase 3 to a query (3, 4), and he can answer with the phrase 1 or phrase 3 to a query (1, 5).

Help Vitya win in no more than 600 rounds. 

Input

The first line contains a single integer n (1 ≤ n ≤ 10^{18}) — the upper limit of the numbers.

Interaction

First, you need to read the number n, after that you can make queries.

To make a query, print two integers: x and y (1 ≤ x, y ≤ n), then flush the output.

After each query, read a single integer ans (0 ≤ ans ≤ 3).

If ans > 0, then it is the number of the phrase said by Vasya.

If ans = 0, it means that you win and your program should terminate.

If you make more than 600 queries or make an incorrect query, you will get Wrong Answer.

Your solution will get Idleness Limit Exceeded, if you don't print anything or forget to flush the output.

To flush you need to do the following right after printing a query and a line end: 

  * fflush(stdout) in C++; 
  * System.out.flush() in Java; 
  * stdout.flush() in Python; 
  * flush(output) in Pascal; 
  * For other languages see documentation. 



Hacks format

For hacks, use the following format:

In the first line, print a single integer n (1 ≤ n ≤ 10^{18}) — the upper limit of the numbers.

In the second line, print two integers a and b (1 ≤ a, b ≤ n) — the numbers which Vasya thought of.

In the third line, print a single integer m (1 ≤ m ≤ 10^5) — the number of instructions for the interactor.

In each of the next m lines, print five integers: x_i, y_i, r^{12}_i, r^{13}_i, and r^{23}_i (1 ≤ x_i, y_i ≤ n), where r^{ST}_i equals to either number S or number T.

While answering the query x   y, the interactor finds a number i from 1 to n with the minimal value |x-x_i| + |y-y_i|. If multiple numbers can be chosen, the least i is preferred. Then the interactor answers to the query, but if there are two phrases S and T that can be given, then r^{ST}_i is chosen.

For example, the sample test data file contains the following: 
    
    
      
    5  
    2 4  
    2  
    2 5 1 1 2  
    4 1 2 3 3  
    

Example

Input

5
3
3
2
1
0

Output

4 3
3 4
3 3
1 5
2 4

Note

Let's analyze the sample test. The chosen numbers are 2 and 4. The interactor was given two instructions.

For the query (4, 3), it can return 2 or 3. Out of the two instructions the second one is chosen, so the interactor returns a^{23}_2=3.

For the query (3, 4), it can return only 3.

For the query (3, 3), it can return 2 or 3. Out of the two instructions the first one is chosen (since in case of equal values, the least number is preferred), so the interactor returns a^{23}_1=2.

For the query (1, 5), it can return 1 or 3. Out of the two instructions the first one is chosen, so the interactor returns a^{13}_1=1.

In the fifth query (2, 4), the numbers are guessed correctly, the player wins.

Solution (in JAVA):

Solution:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Egor Kulikov (egor@egork.net)
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            long n = in.readLong();
            List<TaskC.Variant> variants = new ArrayList<>();
            variants.add(new TaskC.Variant(1, n, 1, n));
            while (true) {
                double best = Double.POSITIVE_INFINITY;
                TaskC.Variant variant = null;
                for (TaskC.Variant v : variants) {
                    long x = v.aFrom + ((v.aTo - v.aFrom) / 3);
                    long y = v.bFrom + ((v.bTo - v.bFrom) / 3);
                    double total1 = 2 * v.score() / 3;
                    double total2 = 2 * v.score() / 3;
                    double total3 = 2 * v.score() / 3;
                    for (TaskC.Variant vv : variants) {
                        if (v == vv) {
                            continue;
                        }
                        if (vv.aTo > x) {
                            if (vv.aFrom > x) {
                                total1 += vv.score();
                            } else {
                                total1 += (double) (vv.aTo - x) * (vv.bTo - vv.bFrom + 1);
                            }
                        }
                        if (vv.bTo > y) {
                            if (vv.bFrom > y) {
                                total2 += vv.score();
                            } else {
                                total2 += (double) (vv.bTo - y) * (vv.aTo - vv.aFrom + 1);
                            }
                        }
                        if (x > vv.aTo || y > vv.bTo) {
                            total3 += vv.score();
                        } else if (x > v.aFrom) {
                            total3 += (double) (x - vv.aFrom) * (vv.bTo - vv.bFrom + 1);
                        } else if (y > v.bFrom) {
                            total3 += (double) (y - vv.bFrom) * (vv.aTo - vv.aFrom + 1);
                        }
                    }
                    double value = Math.max(total1, Math.max(total2, total3));
                    if (value < best) {
                        variant = v;
                        best = value;
                    }
                }
                long x = variant.aFrom + ((variant.aTo - variant.aFrom) / 3);
                long y = variant.bFrom + ((variant.bTo - variant.bFrom) / 3);
                out.printLine(x, y);
                out.flush();
                int answer = in.readInt();
                if (answer == 0) {
                    return;
                }
                List<TaskC.Variant> next = new ArrayList<>();
                int num = 0;
                for (TaskC.Variant v : variants) {
                    if (answer == 1) {
                        if (v.aTo <= x) {
                            continue;
                        }
                        v.aFrom = Math.max(v.aFrom, x + 1);
                        next.add(v);
                    } else if (answer == 2) {
                        if (v.bTo <= y) {
                            continue;
                        }
                        v.bFrom = Math.max(v.bFrom, y + 1);
                        next.add(v);
                    } else {
                        if (x <= v.aFrom && y <= v.bFrom) {
                            continue;
                        }
                        if (x > v.aTo || y > v.bTo) {
                            next.add(v);
                            continue;
                        }
                        int all = 0;
                        if (x > v.aFrom) {
                            next.add(new TaskC.Variant(v.aFrom, x - 1, Math.max(y, v.bFrom), v.bTo));
                            all++;
                        }
                        if (y > v.bFrom) {
                            next.add(new TaskC.Variant(Math.max(x, v.aFrom), v.aTo, v.bFrom, y - 1));
                            all++;
                        }
                        if (x > v.aFrom && y > v.bFrom) {
                            next.add(new TaskC.Variant(v.aFrom, x - 1, v.bFrom, y - 1));
                            all++;
                        }
                        if (all == 3) {
                            num++;
                        }
                    }
                }
                variants = next;
            }
        }

        static class Variant {
            long aFrom;
            long aTo;
            long bFrom;
            long bTo;

            public Variant(long aFrom, long aTo, long bFrom, long bTo) {
                this.aFrom = aFrom;
                this.aTo = aTo;
                this.bFrom = bFrom;
                this.bTo = bTo;
            }

            double score() {
                return (double) (aTo - aFrom + 1) * (bTo - bFrom + 1);
            }

        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long readLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

        public void flush() {
            writer.flush();
        }

    }
}