#include <bits/stdc++.h>
using namespace std;
int t;
long long x, y;
inline void ask(long long x, long long y) {
  printf("%I64d %I64d\n", x, y);
  fflush(stdout), scanf("%d", &t);
  ::x = x, ::y = y;
}
void solve(long long xmn, long long x, long long xmx, long long ymn,
           long long y, long long ymx) {
  if (x < xmn) x = xmx, ymx = y;
  if (y < ymn) y = ymx, xmx = x;
  double A = (double)(x - xmn + 1) * (y - ymn + 1);
  double B = (double)(x - xmn + 1) * (ymx - y);
  double C = (double)(xmx - x) * (y - ymn + 1);
  if (B > A + C)
    ask(x + xmn >> 1, y);
  else if (C > A + B)
    ask(x, y + ymn >> 1);
  else
    ask(x + xmn >> 1, y + ymn >> 1);
  if (t == 1) solve(::x + 1, x, xmx, ymn, y, ymx);
  if (t == 2) solve(xmn, x, xmx, ::y + 1, y, ymx);
  if (t == 3) solve(xmn, ::x - 1, xmx, ymn, ::y - 1, ymx);
}
int main() {
  long long n;
  scanf("%I64d", &n);
  solve(1, n, n, 1, n, n);
}
