#include <bits/stdc++.h>
using namespace std;
using cat = long long;
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(10);
  cat N;
  cin >> N;
  cat L[2] = {1, 1}, R[2] = {N + 1, N + 1}, C[2] = {0, 0};
  while (R[0] - L[0] > 1 || R[1] - L[1] > 1) {
    cat d[2] = {R[0] - C[0] - 1, R[1] - C[1] - 1};
    cat mid[2] = {(C[0] + R[0] + 1) / 2, (C[1] + R[1] + 1) / 2};
    if (min(d[0], d[1]) * 2 < max(d[0], d[1]) && min(d[0], d[1]) > 5)
      if (2 * d[0] < R[0] - L[0] && 2 * d[1] < R[1] - L[1]) {
        if (d[0] < d[1])
          mid[0] = max(L[0], C[0]);
        else
          mid[1] = max(L[1], C[1]);
      }
    cout << N + 1 - mid[0] << " " << N + 1 - mid[1] << "\n";
    cout << flush;
    int ans;
    cin >> ans;
    if (ans == 0) return 0;
    if (ans == 3) {
      C[0] = mid[0];
      C[1] = mid[1];
    } else
      R[ans - 1] = mid[ans - 1];
    if (C[0] + 1 >= R[0]) {
      L[1] = C[1] + 1;
      C[0] = L[0] - 1;
    } else if (C[1] + 1 >= R[1]) {
      L[0] = C[0] + 1;
      C[1] = L[1] - 1;
    }
  }
  cout << N + 1 - L[0] << " " << N + 1 - L[1] << "\n";
  cout << flush;
  int ans;
  cin >> ans;
  return 0;
}
