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;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;
template <class T>
ostream& operator<<(ostream& os, const V<T>& v) {
  cout << "[";
  for (auto p : v) cout << p << ", ";
  cout << "]";
  return os;
}
ll rand_int(ll l, ll r) {
  using D = uniform_int_distribution<ll>;
  static random_device rd;
  static mt19937 gen(rd());
  return D(l, r)(gen);
}
const bool DEB = false;
ll n;
ll deb_x, deb_y;
void init() {
  if (DEB) {
    n = TEN(18) - 1919;
    deb_x = rand_int(1, n);
    deb_y = rand_int(1, n);
  } else {
    cin >> n;
  }
}
int query(ll x, ll y) {
  assert(1 <= x && x <= n);
  assert(1 <= y && y <= n);
  if (DEB) {
    static int gc = 0;
    gc++;
    V<int> pred;
    if (deb_x < x || deb_y < y) pred.push_back(3);
    if (x < deb_x) pred.push_back(1);
    if (y < deb_y) pred.push_back(2);
    int c = int(pred.size());
    if (c) return pred[rand_int(0, c - 1)];
    cout << "CONGRAT! : " << gc << " " << deb_x << " " << deb_y << endl;
    assert(deb_x == x && deb_y == y);
    exit(0);
  } else {
    cout << x << " " << y << endl;
    int ty;
    cin >> ty;
    if (ty == 0) exit(0);
    return ty;
  }
}
void solve(ll la, ll lb, ll ua, ll ub);
void solve(ll la, ll lb, ll ua, ll ub, ll ma, ll mb) {
  if (ma == la) {
    solve(la, lb, ua, mb - 1);
    assert(false);
  }
  if (mb == lb) {
    solve(la, lb, ma - 1, ub);
    assert(false);
  }
  ll da = ma - la + 1;
  ll db = mb - lb + 1;
  if (da > db) {
    ll xa = (ma + la) / 2;
    int ty1 = query(xa, mb);
    if (ty1 == 1) {
      solve(xa + 1, lb, ua, ub, ma, mb);
      assert(false);
    }
    if (ty1 == 2) {
      solve(la, mb + 1, ma - 1, ub);
      assert(false);
    }
    solve(la, lb, ua, ub, xa, mb);
  } else {
    ll xb = (mb + lb) / 2;
    int ty1 = query(ma, xb);
    if (ty1 == 2) {
      solve(la, xb + 1, ua, ub, ma, mb);
      assert(false);
    }
    if (ty1 == 1) {
      solve(ma + 1, lb, ua, mb - 1);
      assert(false);
    }
    solve(la, lb, ua, ub, ma, xb);
  }
  assert(false);
}
void solve(ll la, ll lb, ll ua, ll ub) {
  if (la == ua && lb == ub) query(la, lb);
  ll ma = (3 * la + ua) / 4;
  ll mb = (3 * lb + ub) / 4;
  int ty = query(ma, mb);
  if (ty == 1) {
    solve(ma + 1, lb, ua, ub);
    assert(false);
  }
  if (ty == 2) {
    solve(la, mb + 1, ua, ub);
    assert(false);
  }
  solve(la, lb, ua, ub, ma, mb);
}
int main() {
  init();
  solve(1, 1, n, n);
  assert(false);
  return 0;
}