#include <bits/stdc++.h>
using namespace std;
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
inline int msbp(int x) { return 31 - __builtin_clz(x); }
inline int msb(int x) { return 1 << msbp(x); }
const int INF = 0x3f3f3f3f;
long long n, xl, xm, xr, yl, ym, yr;
void query(long long x, long long y) {
  int res;
  cout << x << ' ' << y << endl;
  cin >> res;
  if (res == 0)
    exit(0);
  else if (res == 1) {
    if (xm == x) {
      xm = xr;
      yr = ym;
    }
    xl = x + 1;
  } else if (res == 2) {
    if (ym == y) {
      ym = yr;
      xr = xm;
    }
    yl = y + 1;
  } else {
    xm = x;
    ym = y;
  }
}
long double area(long double x1, long double x2, long double y1,
                 long double y2) {
  return (y1 - y2) * (x1 - x2);
}
signed main() {
  ios::sync_with_stdio(false);
  cin >> n;
  xm = xr = ym = yr = n + 1;
  while (xl < xm + 1 && yl < ym + 1) {
    long double sa = area(xl, xm, yl, ym);
    long double sb = area(xl, xm, ym, yr);
    long double sc = area(xm, xr, yl, ym);
    long long xh = (xl + xm) / 2, yh = (yl + ym) / 2;
    if (sa >= sb - sc && sa >= sc - sb) {
      query(xh, yh);
    } else if (sb > sa + sc) {
      query(xh, ym);
    } else if (sc > sa + sb) {
      query(xm, yh);
    } else {
      assert(false);
    }
  }
  query(xl, yl);
  return 0;
}
