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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
struct Point {
  long long int x, y;
};
class Field {
 public:
  Field(long long int size);
  void cutLeft(long long int x);
  void cutBottom(long long int y);
  void deepenCorner(long long int x, long long int y);
  bool splitCorner();
  Point missedCorner();
  void mergeCorners(int type);
  void print();
  Point guess();

 private:
  Point bl, tr;
  Point cnr;
  Point dbl;
  bool split;
  void goDownIfNeeded() {
    if (bl.x >= cnr.x) {
      tr.y = cnr.y - 1;
      cnr.x = tr.x + 1;
    }
  }
  void goLeftIfNeeded() {
    if (bl.y >= cnr.y) {
      tr.x = cnr.x - 1;
      cnr.y = tr.y + 1;
    }
  }
};
Field::Field(long long int size) {
  bl = {1, 1};
  tr = {size, size};
  cnr = {size + 1, size + 1};
  split = false;
};
void Field::cutLeft(long long int x) {
  if (x >= bl.x && x < tr.x) {
    bl.x = x + 1;
    goDownIfNeeded();
  }
}
void Field::cutBottom(long long int y) {
  if (y >= bl.y && y < tr.y) {
    bl.y = y + 1;
    goLeftIfNeeded();
  }
}
void Field::deepenCorner(long long int x, long long int y) {
  if (x <= cnr.x && y <= cnr.y) {
    if (x > bl.x || y > bl.y) {
      cnr.x = x;
      cnr.y = y;
      goDownIfNeeded();
      goLeftIfNeeded();
    }
  } else if (x < cnr.x || y < cnr.y) {
    if (x <= tr.x && y <= tr.y) {
      if (x <= bl.x) {
        tr.y = y - 1;
      } else if (y <= bl.y) {
        tr.x = x - 1;
      } else {
        split = true;
        dbl.x = x;
        dbl.y = y;
      }
    }
  }
}
bool Field::splitCorner() { return split; }
Point Field::missedCorner() {
  if (split) {
    return {min(cnr.x, dbl.x), min(cnr.y, dbl.y)};
  }
  return cnr;
}
void Field::mergeCorners(int type) {
  Point msd = missedCorner();
  if (type == 1) {
    bl.x = msd.x;
    if (dbl.y < cnr.y) {
      tr.y = cnr.y - 1;
      cnr = dbl;
    } else {
      tr.y = dbl.y - 1;
    }
  } else if (type == 2) {
    bl.y = msd.y;
    if (dbl.x < cnr.x) {
      tr.x = cnr.x - 1;
      cnr = dbl;
    } else {
      tr.x = dbl.x;
    }
  } else {
    deepenCorner(msd.x, msd.y);
  }
  split = false;
}
void Field::print() {
  cout << "bl: "
       << "(" << bl.x << ", " << bl.y << ")" << endl;
  cout << "tr: "
       << "(" << tr.x << ", " << tr.y << ")" << endl;
  cout << "cnr: "
       << "(" << cnr.x << ", " << cnr.y << ")" << endl;
  cout << "dbl: "
       << "(" << dbl.x << ", " << dbl.y << ")" << endl;
  cout << "split: " << split << endl;
}
Point Field::guess() {
  long long int n = tr.x - bl.x + 1;
  long long int m = tr.y - bl.y + 1;
  long long int s = tr.x - cnr.x + 1;
  long long int t = tr.y - cnr.y + 1;
  long double mdn = ((long double)m) / n;
  long double ndm = ((long double)n) / m;
  long long int u;
  long long int v;
  long long int bord = (long long int)(((long double)m) / n * s);
  if (t > bord) {
    u = (long long int)(((long double)n / m) * t);
    ;
    v = t;
  } else {
    u = s;
    v = bord;
  }
  long double a = ((long double)(n - s)) * ((long double)(m - t));
  long double b = ((long double)n) * ((long double)(m + t)) -
                  2 * ((long double)s) * ((long double)t);
  long double c = ((long double)m) * ((long double)(s - n)) +
                  ((long double)s) * ((long double)t) +
                  ((long double)u) * ((long double)v);
  long double d = b * b - 4 * a * c;
  long double p = (-b + sqrt(d)) / (2 * a);
  long double p2 = (-b - sqrt(d)) / (2 * a);
  Point g;
  p = 1 - p;
  if (p >= 0 && p <= 1) {
    g.x = bl.x + p * (cnr.x - bl.x);
    g.y = bl.y + p * (cnr.y - bl.y);
  } else {
    long double q = 0.5;
    if (cnr.x - bl.x > cnr.y - bl.y) {
      g.x = bl.x + (cnr.x - bl.x) * q;
      g.y = bl.y + (tr.y - bl.y) * q;
    } else {
      g.x = bl.x + (tr.x - bl.x) * q;
      g.y = bl.y + (cnr.y - bl.y) * q;
    }
  }
  return g;
}
int query(Point g) {
  int ans;
  cout << g.x << " " << g.y << endl;
  cin >> ans;
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  long long int N;
  cin >> N;
  Field f(N);
  Point g;
  for (int ans = query(g = f.guess()); ans; ans = query(g = f.guess())) {
    if (ans == 1) {
      f.cutLeft(g.x);
    }
    if (ans == 2) {
      f.cutBottom(g.y);
    }
    if (ans == 3) {
      f.deepenCorner(g.x, g.y);
      if (f.splitCorner()) {
        Point h = f.missedCorner();
        int aux = query(h);
        if (aux == 0) {
          return 0;
        } else {
          f.mergeCorners(aux);
        }
      }
    }
  }
  return 0;
}